Fix bug 1793462 (part 1): add a resource to disable the "SIM network unlock" screen
David Brown [Tue, 21 Apr 2009 02:07:31 +0000 (19:07 -0700)]
Some networks may not have the concept of "unlocking a SIM", in which case
we should *not* show the "Sim network lock" screen even if we get an
EVENT_SIM_NETWORK_LOCKED message.

This change adds a boolean resource called ignore_sim_network_locked_events;
if true, the phone app will ignore EVENT_SIM_NETWORK_LOCKED events.
The default value is false, meaning that a EVENT_SIM_NETWORK_LOCKED event
will launch the IccNetworkDepersonalizationPanel, and prevent the user from
doing anything else until they enter a valid SIM network PIN (i.e. the
current behavior.)

To change this behavior, just set ignore_sim_network_locked_events to true
in a product-specific overlay file.

TESTED: faked an EVENT_SIM_NETWORK_LOCKED.
  With ignore_sim_network_locked_events=false, the
  IccNetworkDepersonalizationPanel came up normally.
  With ignore_sim_network_locked_events=true, nothing happened.

res/values/config.xml [new file with mode: 0644]
src/com/android/phone/PhoneApp.java

diff --git a/res/values/config.xml b/res/values/config.xml
new file mode 100644 (file)
index 0000000..fed0052
--- /dev/null
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+  
+          http://www.apache.org/licenses/LICENSE-2.0
+  
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<!-- Phone app resources that may need to be customized
+     for different hardware or product builds. -->
+<resources>
+    <!-- Flag indicating whether the Phone app should ignore
+         EVENT_SIM_NETWORK_LOCKED events from the Sim.  If true, this will
+         prevent the IccNetworkDepersonalizationPanel from being shown,
+         and effectively disable the "Sim network lock" feature. -->
+    <bool name="ignore_sim_network_locked_events">false</bool>
+</resources>
index 2c294bc..664ef80 100644 (file)
@@ -215,10 +215,19 @@ public class PhoneApp extends Application {
                     break;
 
                 case EVENT_SIM_NETWORK_LOCKED:
-                    if (Config.LOGV) Log.v(LOG_TAG, "show sim depersonal panel");
-                    IccNetworkDepersonalizationPanel ndpPanel =
-                        new IccNetworkDepersonalizationPanel(PhoneApp.getInstance());
-                    ndpPanel.show();
+                    if (getResources().getBoolean(R.bool.ignore_sim_network_locked_events)) {
+                        // Some products don't have the concept of a "SIM network lock"
+                        Log.i(LOG_TAG, "Ignoring EVENT_SIM_NETWORK_LOCKED event; "
+                              + "not showing 'SIM network unlock' PIN entry screen");
+                    } else {
+                        // Normal case: show the "SIM network unlock" PIN entry screen.
+                        // The user won't be able to do anything else until
+                        // they enter a valid SIM network PIN.
+                        Log.i(LOG_TAG, "show sim depersonal panel");
+                        IccNetworkDepersonalizationPanel ndpPanel =
+                                new IccNetworkDepersonalizationPanel(PhoneApp.getInstance());
+                        ndpPanel.show();
+                    }
                     break;
 
                 case EVENT_UPDATE_INCALL_NOTIFICATION:
@@ -1112,6 +1121,3 @@ public class PhoneApp extends Application {
         }
     }
 }
-
-
-