Yes (but read on). Texting, gaming, watching videos, scrolling on social media, etc. are all accepted. You’re good to go as long as it doesn’t disturb others. With that said, there are a couple of rules.

Calling — please don’t!
You may have noticed that even a jam-packed train can be dead silent in Japan. Calling is a definite no-go. This relates to the Japanese concept of “meiwaku wo kakenai (don’t inconvenience others),” a mindset that helps maintain collective harmony through each individual doing their part. Think about it: Would you rather be on a packed train, or on a LOUD packed train?
If it’s an absolute emergency, you can move by the door and talk very quietly on the phone, but it’s not ideal. On a shinkansen (bullet train), you can move to the space between carriages if you absolutely have to take a call.
Also, make sure to use earphones or headphones when listening to music or watching videos. Having a quiet conversation is fine, but again, make sure not to disturb anyone.
Protect the pacemakers
Also, technically, you should turn off your phones around priority seats, which are reserved for people with disabilities and injured, pregnant, or elderly individuals as well as small children. The concern is that the radio waves emitted by mobile devices may disrupt those who may have pacemakers. Although I’ve never seen anyone actually follow this rule (especially because it can only make a difference if the phone is 15 centimeters or less from the implanted medical device), it would be a very considerate gesture.