Snap for 10102166 from f04f33e8ccc7fffa86a1c79ea0c9f019d73a6851 to mainline-tzdata4-release

Change-Id: I8f33d8e08abcf4d276daad4126ce920a7d13512d
diff --git a/OWNERS b/OWNERS
index 16b6026..a37fa57 100644
--- a/OWNERS
+++ b/OWNERS
@@ -1,17 +1,3 @@
-amitmahajan@google.com
-breadley@google.com
-fionaxu@google.com
-jackyu@google.com
-rgreenwalt@google.com
-tgunn@google.com
-jminjie@google.com
-shuoq@google.com
-sarahchin@google.com
-xiaotonj@google.com
-huiwang@google.com
-jayachandranc@google.com
-chinmayd@google.com
-amruthr@google.com
-sasindran@google.com
+include platform/packages/apps/CellBroadcastReceiver:/OWNERS
 
 include platform/packages/modules/common:/MODULES_OWNERS  # see go/mainline-owners-policy
diff --git a/res/values-mcc334-mnc03/config.xml b/res/values-mcc334-mnc03/config.xml
deleted file mode 100644
index ec0c507..0000000
--- a/res/values-mcc334-mnc03/config.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2020 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.
--->
-
-<resources>
-    <!-- Cell broadcast channels for area info update. Note the channel configuration for area info
-         is needed in CellBroadcastReceiver as well.  -->
-    <integer-array name="area_info_channels">
-    </integer-array>
-</resources>
diff --git a/res/values-mcc334-mnc030 b/res/values-mcc334-mnc030
deleted file mode 120000
index f13e2df..0000000
--- a/res/values-mcc334-mnc030
+++ /dev/null
@@ -1 +0,0 @@
-values-mcc334-mnc03
\ No newline at end of file
diff --git a/res/values-mcc334/config.xml b/res/values-mcc334/config.xml
deleted file mode 100644
index 261ef67..0000000
--- a/res/values-mcc334/config.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2020 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.
--->
-
-<resources>
-    <!-- Cell broadcast channels for area info update. Note the channel configuration for area info
-         is needed in CellBroadcastReceiver as well.  -->
-    <integer-array name="area_info_channels">
-        <item>50</item>
-    </integer-array>
-</resources>
diff --git a/res/values-mcc404/config.xml b/res/values-mcc404/config.xml
deleted file mode 100644
index 261ef67..0000000
--- a/res/values-mcc404/config.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2020 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.
--->
-
-<resources>
-    <!-- Cell broadcast channels for area info update. Note the channel configuration for area info
-         is needed in CellBroadcastReceiver as well.  -->
-    <integer-array name="area_info_channels">
-        <item>50</item>
-    </integer-array>
-</resources>
diff --git a/res/values-mcc405/config.xml b/res/values-mcc405/config.xml
deleted file mode 100644
index 361d534..0000000
--- a/res/values-mcc405/config.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2020 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.
--->
-
-<resources>
-    <!-- Cell broadcast channels for area info update. Note the channel configuration for area info
-         is needed in CellBroadcastReceiver as well.  -->
-    <integer-array name="area_info_channels">
-        <item>60</item>
-    </integer-array>
-</resources>
diff --git a/src/com/android/cellbroadcastservice/GsmCellBroadcastHandler.java b/src/com/android/cellbroadcastservice/GsmCellBroadcastHandler.java
index 03b469c..a64e409 100644
--- a/src/com/android/cellbroadcastservice/GsmCellBroadcastHandler.java
+++ b/src/com/android/cellbroadcastservice/GsmCellBroadcastHandler.java
@@ -183,6 +183,8 @@
     }
 
     private void registerServiceStateListeners() {
+        // clean previously registered listeners
+        unregisterServiceStateListeners();
         // register for all active slots
         TelephonyManager tm = mContext.getSystemService(TelephonyManager.class);
         SubscriptionManager sm = mContext.getSystemService(SubscriptionManager.class);
@@ -205,6 +207,7 @@
         for (int i = 0; i < size; i++) {
             tm.listen(mServiceStateListener.valueAt(i), PhoneStateListener.LISTEN_NONE);
         }
+        mServiceStateListener.clear();
     }
 
     private class ServiceStateListener extends PhoneStateListener {
diff --git a/tests/AndroidTest.xml b/tests/AndroidTest.xml
index e2422d6..943965f 100644
--- a/tests/AndroidTest.xml
+++ b/tests/AndroidTest.xml
@@ -14,7 +14,7 @@
      limitations under the License.
 -->
 <configuration description="Run Tests for CellBroadcastService.">
-    <target_preparer class="com.android.tradefed.targetprep.TestAppInstallSetup">
+    <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="test-file-name" value="CellBroadcastServiceTests.apk" />
     </target_preparer>
 
diff --git a/tests/src/com/android/cellbroadcastservice/tests/GsmCellBroadcastHandlerTest.java b/tests/src/com/android/cellbroadcastservice/tests/GsmCellBroadcastHandlerTest.java
index ec62a9b..951f4f8 100644
--- a/tests/src/com/android/cellbroadcastservice/tests/GsmCellBroadcastHandlerTest.java
+++ b/tests/src/com/android/cellbroadcastservice/tests/GsmCellBroadcastHandlerTest.java
@@ -555,6 +555,7 @@
                 ArgumentCaptor.forClass(PhoneStateListener.class);
         mTestableLooper.processAllMessages();
 
+        verify(mMockedTelephonyManager).listen(any(), eq(PhoneStateListener.LISTEN_NONE));
         verify(tm2).listen(listenerCaptor.capture(), anyInt());
 
         PhoneStateListener listener = listenerCaptor.getValue();