Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 13647d75 authored by Wei Huang's avatar Wei Huang Committed by Beverly Tai
Browse files

Fix SystemUI mapping SIM state error issue



KeyguardUpdateMonitor#SimData#simState is updated from telephony
broadcast whose action is Intent#ACTION_SIM_STATE_CHANGED,
but the sim state mapping is inconsistent with telephony design.

Below are the telephony design of broadcast extra(SIM state and reason)
mapping matrix for action Intent#ACTION_SIM_STATE_CHANGED:
1. SIM card state unknown:
   a) Intent#EXTRA_SIM_STATE: Intent#SIM_STATE_UNKNOWN
   b) Intent#EXTRA_SIM_LOCKED_REASON: always null
2. SIM absent:
   a) Intent#EXTRA_SIM_STATE: Intent#SIM_STATE_ABSENT
   b) Intent#EXTRA_SIM_LOCKED_REASON: always null
3. SIM IO error three consecutive times:
   a) Intent#EXTRA_SIM_STATE: Intent#SIM_STATE_CARD_IO_ERROR
   b) Intent#EXTRA_SIM_LOCKED_REASON: Intent#SIM_STATE_CARD_IO_ERROR
4. SIM card is present but not usable due to carrier restrictions:
   a) Intent#EXTRA_SIM_STATE: Intent#SIM_STATE_CARD_RESTRICTED
   b) Intent#EXTRA_SIM_LOCKED_REASON: Intent#SIM_STATE_CARD_RESTRICTED
5. SIM locked:
   a) Intent#EXTRA_SIM_STATE: Intent#SIM_STATE_LOCKED
   b) Intent#EXTRA_SIM_LOCKED_REASON:
      - locked on PIN1: Intent#SIM_LOCKED_ON_PIN
      - locked on PUK1: Intent#SIM_LOCKED_ON_PUK
      - locked on network personalization: Intent#SIM_LOCKED_NETWORK
      - permanently disabled due to puk fails:
        Intent#SIM_ABSENT_ON_PERM_DISABLED
6. SIM applications are not ready:
   a) Intent#EXTRA_SIM_STATE: Intent#SIM_STATE_NOT_READY
   b) Intent#EXTRA_SIM_LOCKED_REASON: always null
7. SIM IMSI is ready in property, but currently it is never broadcasted:
   a) Intent#EXTRA_SIM_STATE: Intent#SIM_STATE_IMSI
   b) Intent#EXTRA_SIM_LOCKED_REASON: always null
8. SIM all applications are ready:
   a) Intent#EXTRA_SIM_STATE: Intent#SIM_STATE_READY
   b) Intent#EXTRA_SIM_LOCKED_REASON: always null
9. SIM all ICC records, including IMSI, are loaded:
   a) Intent#EXTRA_SIM_STATE: Intent#SIM_STATE_LOADED
   b) Intent#EXTRA_SIM_LOCKED_REASON: always null

Based on above, this patch fixes below points:
1. Upate KeyguardUpdateMonitor#SimData#fromIntent sim state, which
   follows telephony design.
2. Update CarrierTextManager#getStatusForIccState
   a) network locked mapping: TelephonyManager#SIM_STATE_NETWORK_LOCKED
      to CarrierTextManager#StatusMode#NetworkLocked.
   b) adds missed state CarrierTextManager#StatusMode#SimRestricted.
3. Add related automated unit tests to verify code logic

Bug: 265564214
Bug: 265440217
Test: Build and manual test on device.
Test: atest CarrierTextManagerTest KeyguardUpdateMonitorTest
Change-Id: I76eff7a66f2dac6f87072501dc6654e48c105e02
Signed-off-by: default avatarWei Huang <hwbest.v@gmail.com>
Signed-off-by: default avatarHonggang Luo <luo.loky@gmail.com>
Signed-off-by: default avatarChao Yuan <chaoyuanx@gmail.com>
parent 28227a3e
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment