Merge "Remove IMS logs that may contain PII"
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 76e49f6..6b48ef1 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -209,7 +209,7 @@
     <uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" />
     <uses-permission android:name="android.permission.READ_PRECISE_PHONE_STATE" />
     <uses-permission android:name="android.permission.MANAGE_ROLE_HOLDERS" />
-    <!-- Allows us to whitelist receivers of the
+    <!-- Allows us to allow list receivers of the
          ACTION_SIM_SLOT_STATUS_CHANGED broadcast to start activities
          from the background.  -->
     <uses-permission android:name="android.permission.START_ACTIVITIES_FROM_BACKGROUND" />
diff --git a/ecc/input/OWNERS b/ecc/input/OWNERS
new file mode 100644
index 0000000..d9ecbb7
--- /dev/null
+++ b/ecc/input/OWNERS
@@ -0,0 +1,5 @@
+set noparent
+
+djkrause@google.com
+satk@google.com
+somakala@google.com
\ No newline at end of file
diff --git a/ecc/output/OWNERS b/ecc/output/OWNERS
new file mode 100644
index 0000000..d9ecbb7
--- /dev/null
+++ b/ecc/output/OWNERS
@@ -0,0 +1,5 @@
+set noparent
+
+djkrause@google.com
+satk@google.com
+somakala@google.com
\ No newline at end of file
diff --git a/res/layout/sim_ndp.xml b/res/layout/sim_ndp.xml
index 5f03d7b..e16f99a 100644
--- a/res/layout/sim_ndp.xml
+++ b/res/layout/sim_ndp.xml
@@ -35,6 +35,13 @@
                 android:layout_height="wrap_content"
                 android:text="@string/label_ndp"/>
 
+        <TextView
+                android:id="@+id/perso_phoneid_text"
+                android:textAppearance="?android:attr/textAppearanceMedium"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="@string/label_phoneid"/>
+
         <EditText android:id="@+id/pin_entry"
                 android:inputType="textPassword"
                 android:imeOptions="actionDone"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 54047c2..6bcac12 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -107,6 +107,8 @@
     <!-- network depersonalization -->
     <!-- Label text for PIN entry widget on SIM Network Depersonalization panel -->
     <string name="label_ndp">SIM network unlock PIN</string>
+    <!-- Label text for Operator displayName on SIM Network Depersonalization panel -->
+    <string name="label_phoneid">Perso Locked for</string>
     <!-- Button label on SIM Network Depersonalization panel -->
     <string name="sim_ndp_unlock_text">Unlock</string>
     <!-- Button label on SIM Network Depersonalization panel -->
diff --git a/src/com/android/phone/IccNetworkDepersonalizationPanel.java b/src/com/android/phone/IccNetworkDepersonalizationPanel.java
index a26225e..a4ec8a4 100644
--- a/src/com/android/phone/IccNetworkDepersonalizationPanel.java
+++ b/src/com/android/phone/IccNetworkDepersonalizationPanel.java
@@ -23,6 +23,8 @@
 import android.os.Message;
 import android.os.PersistableBundle;
 import android.telephony.CarrierConfigManager;
+import android.telephony.SubscriptionInfo;
+import android.telephony.SubscriptionManager;
 import android.telephony.TelephonyManager;
 import android.text.Editable;
 import android.text.Spannable;
@@ -68,6 +70,7 @@
     private static IccNetworkDepersonalizationPanel [] sNdpPanel =
             new IccNetworkDepersonalizationPanel[
                     TelephonyManager.getDefault().getSupportedModemCount()];
+    private SubscriptionInfo mSir;
 
     //UI elements
     private EditText     mPinEntry;
@@ -75,6 +78,7 @@
     private LinearLayout mStatusPanel;
     private TextView     mPersoSubtypeText;
     private PersoSubState mPersoSubState;
+    private TextView     mPhoneIdText;
     private TextView     mStatusText;
 
     private Button       mUnlockButton;
@@ -167,6 +171,8 @@
         super(context);
         mPhone = PhoneGlobals.getPhone();
         mPersoSubtype = PersoSubState.PERSOSUBSTATE_SIM_NETWORK.ordinal();
+        mSir = SubscriptionManager.from(context)
+                .getActiveSubscriptionInfoForSimSlotIndex(mPhone.getPhoneId());
     }
 
     //constructor
@@ -175,6 +181,8 @@
         super(context);
         mPhone = phone == null ? PhoneGlobals.getPhone() : phone;
         mPersoSubtype = subtype;
+        mSir = SubscriptionManager.from(context)
+                .getActiveSubscriptionInfoForSimSlotIndex(mPhone.getPhoneId());
     }
 
     @Override
@@ -194,6 +202,7 @@
 
         mEntryPanel = (LinearLayout) findViewById(R.id.entry_panel);
         mPersoSubtypeText = (TextView) findViewById(R.id.perso_subtype_text);
+        mPhoneIdText = (TextView) findViewById(R.id.perso_phoneid_text);
         displayStatus(statusType.ENTRY.name());
 
         mUnlockButton = (Button) findViewById(R.id.ndp_unlock);
@@ -282,6 +291,17 @@
             log ("Unsupported Perso Subtype :" + mPersoSubState.name());
             return;
         }
+        if(mSir != null) {
+            CharSequence displayName = mSir.getDisplayName();
+            log("Operator displayName is: " + displayName + "phoneId: " + mPhone.getPhoneId());
+
+            if(displayName != null && displayName != "") {
+                // Displaying Operator displayName  on UI
+                String phoneIdText = getContext().getString(R.string.label_phoneid)
+                        + ": " + displayName;
+                mPhoneIdText.setText(phoneIdText);
+            }
+        }
 
         if (type == statusType.ENTRY.name()) {
             String displayText = getContext().getString(label);
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 8c6be60..c4a669d 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -116,6 +116,7 @@
 import android.telephony.ims.stub.ImsRegistrationImplBase;
 import android.text.TextUtils;
 import android.util.ArraySet;
+import android.util.EventLog;
 import android.util.Log;
 import android.util.Pair;
 
@@ -755,7 +756,9 @@
                     if (ar.exception == null && ar.result != null) {
                         request.result = ar.result;     // Integer
                     } else {
-                        request.result = null;
+                        // request.result must be set to something non-null
+                        // for the calling thread to unblock
+                        request.result = new int[]{-1};
                         if (ar.result == null) {
                             loge("getPreferredNetworkType: Empty response");
                         } else if (ar.exception instanceof CommandException) {
@@ -2505,12 +2508,21 @@
                                 .setCallingPid(Binder.getCallingPid())
                                 .setCallingUid(Binder.getCallingUid())
                                 .setMethod("requestCellInfoUpdate")
-                                .setMinSdkVersionForFine(Build.VERSION_CODES.Q)
+                                .setMinSdkVersionForCoarse(Build.VERSION_CODES.BASE)
+                                .setMinSdkVersionForFine(Build.VERSION_CODES.BASE)
                                 .build());
         switch (locationResult) {
             case DENIED_HARD:
+                if (getTargetSdk(callingPackage) < Build.VERSION_CODES.Q) {
+                    // Safetynet logging for b/154934934
+                    EventLog.writeEvent(0x534e4554, "154934934", Binder.getCallingUid());
+                }
                 throw new SecurityException("Not allowed to access cell info");
             case DENIED_SOFT:
+                if (getTargetSdk(callingPackage) < Build.VERSION_CODES.Q) {
+                    // Safetynet logging for b/154934934
+                    EventLog.writeEvent(0x534e4554, "154934934", Binder.getCallingUid());
+                }
                 try {
                     cb.onCellInfo(new ArrayList<CellInfo>());
                 } catch (RemoteException re) {