Fix import of Rlog - generated by formatting tool am: 3aa74a7a16

Change-Id: Ia964ee7011a3ab28e41fb0af1b132baa4834126c
diff --git a/Android.bp b/Android.bp
index 456d5b4..e79a55d 100644
--- a/Android.bp
+++ b/Android.bp
@@ -19,10 +19,7 @@
     name: "ONS",
     platform_apis: true,
     privileged: true,
-    libs: [
-        "telephony-common",
-        "app-compat-annotations",
-    ],
+    libs: ["telephony-common"],
     srcs: ["src/**/*.java"],
     aaptflags: ["--auto-add-overlay"],
     certificate: "platform",
diff --git a/src/com/android/ons/ONSProfileSelector.java b/src/com/android/ons/ONSProfileSelector.java
index 33ff65b..029eb8a 100644
--- a/src/com/android/ons/ONSProfileSelector.java
+++ b/src/com/android/ons/ONSProfileSelector.java
@@ -146,8 +146,7 @@
                                                     .UPDATE_AVAILABLE_NETWORKS_INVALID_ARGUMENTS);
                                 } else {
                                     if (Compatibility.isChangeEnabled(
-                                            OpportunisticNetworkService
-                                                    .CALLBACK_ON_MORE_ERROR_CODE_CHANGE)) {
+                                            TelephonyManager.CALLBACK_ON_MORE_ERROR_CODE_CHANGE)) {
                                         sendUpdateNetworksCallbackHelper(mNetworkScanCallback,
                                                 TelephonyManager
                                                         .UPDATE_AVAILABLE_NETWORKS_SERVICE_IS_DISABLED);
@@ -171,8 +170,7 @@
                                 TelephonyManager.UPDATE_AVAILABLE_NETWORKS_SUCCESS);
                         } else {
                             if (Compatibility.isChangeEnabled(
-                                    OpportunisticNetworkService
-                                            .CALLBACK_ON_MORE_ERROR_CODE_CHANGE)) {
+                                    TelephonyManager.CALLBACK_ON_MORE_ERROR_CODE_CHANGE)) {
                                 sendUpdateNetworksCallbackHelper(mNetworkScanCallback,
                                         TelephonyManager
                                                 .UPDATE_AVAILABLE_NETWORKS_ENABLE_MODEM_FAIL);
@@ -379,7 +377,7 @@
                 TelephonyManager.UPDATE_AVAILABLE_NETWORKS_SUCCESS);
         } else {
             if (Compatibility.isChangeEnabled(
-                    OpportunisticNetworkService.CALLBACK_ON_MORE_ERROR_CODE_CHANGE)) {
+                    TelephonyManager.CALLBACK_ON_MORE_ERROR_CODE_CHANGE)) {
                 sendUpdateNetworksCallbackHelper(mNetworkScanCallback,
                         TelephonyManager.UPDATE_AVAILABLE_NETWORKS_ENABLE_MODEM_FAIL);
             } else {
@@ -484,7 +482,7 @@
         if (mOppSubscriptionInfos == null) {
             logDebug("null subscription infos");
             if (Compatibility.isChangeEnabled(
-                    OpportunisticNetworkService.CALLBACK_ON_MORE_ERROR_CODE_CHANGE)) {
+                    TelephonyManager.CALLBACK_ON_MORE_ERROR_CODE_CHANGE)) {
                 sendUpdateNetworksCallbackHelper(callbackStub,
                         TelephonyManager.UPDATE_AVAILABLE_NETWORKS_NO_OPPORTUNISTIC_SUB_AVAILABLE);
             } else {
@@ -538,13 +536,14 @@
                             TelephonyManager.UPDATE_AVAILABLE_NETWORKS_SUCCESS);
                     } else {
                         if (Compatibility.isChangeEnabled(
-                                OpportunisticNetworkService.CALLBACK_ON_MORE_ERROR_CODE_CHANGE)) {
+                                TelephonyManager.CALLBACK_ON_MORE_ERROR_CODE_CHANGE)) {
                             sendUpdateNetworksCallbackHelper(callbackStub,
                                     TelephonyManager.UPDATE_AVAILABLE_NETWORKS_ENABLE_MODEM_FAIL);
                         } else {
                             sendUpdateNetworksCallbackHelper(callbackStub,
                                     TelephonyManager.UPDATE_AVAILABLE_NETWORKS_ABORTED);
                         }
+
                     }
                     mProfileSelectionCallback.onProfileSelectionDone();
                     mAvailableNetworkInfos = null;
@@ -556,7 +555,7 @@
             }
         } else if (mOppSubscriptionInfos.size() == 0) {
             if (Compatibility.isChangeEnabled(
-                    OpportunisticNetworkService.CALLBACK_ON_MORE_ERROR_CODE_CHANGE)) {
+                    TelephonyManager.CALLBACK_ON_MORE_ERROR_CODE_CHANGE)) {
                 sendUpdateNetworksCallbackHelper(callbackStub,
                         TelephonyManager.UPDATE_AVAILABLE_NETWORKS_NO_OPPORTUNISTIC_SUB_AVAILABLE);
             } else {
@@ -645,7 +644,7 @@
         int subId = getActiveOpportunisticSubId();
         if (subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
             if (Compatibility.isChangeEnabled(
-                    OpportunisticNetworkService.CALLBACK_ON_MORE_ERROR_CODE_CHANGE)) {
+                    TelephonyManager.CALLBACK_ON_MORE_ERROR_CODE_CHANGE)) {
                 sendUpdateNetworksCallbackHelper(callbackStub,
                         TelephonyManager.UPDATE_AVAILABLE_NETWORKS_NO_OPPORTUNISTIC_SUB_AVAILABLE);
             } else {
@@ -659,7 +658,7 @@
                 TelephonyManager.UPDATE_AVAILABLE_NETWORKS_SUCCESS);
         } else {
             if (Compatibility.isChangeEnabled(
-                    OpportunisticNetworkService.CALLBACK_ON_MORE_ERROR_CODE_CHANGE)) {
+                    TelephonyManager.CALLBACK_ON_MORE_ERROR_CODE_CHANGE)) {
                 sendUpdateNetworksCallbackHelper(callbackStub,
                         TelephonyManager.UPDATE_AVAILABLE_NETWORKS_DISABLE_MODEM_FAIL);
             } else {
@@ -751,6 +750,10 @@
             IUpdateAvailableNetworksCallback callbackStub) {
         logDebug("startProfileSelection availableNetworks: " + availableNetworks);
         if (availableNetworks == null || availableNetworks.size() == 0) {
+            if (callbackStub != null) {
+                sendUpdateNetworksCallbackHelper(callbackStub,
+                        TelephonyManager.UPDATE_AVAILABLE_NETWORKS_INVALID_ARGUMENTS);
+            }
             return;
         }
         Object[] objects = new Object[]{availableNetworks, callbackStub};
@@ -780,7 +783,7 @@
             if (iSub == null) {
                 log("Could not get Subscription Service handle");
                 if (Compatibility.isChangeEnabled(
-                        OpportunisticNetworkService.CALLBACK_ON_MORE_ERROR_CODE_CHANGE)) {
+                        TelephonyManager.CALLBACK_ON_MORE_ERROR_CODE_CHANGE)) {
                     sendSetOpptCallbackHelper(callbackStub,
                             TelephonyManager.SET_OPPORTUNISTIC_SUB_REMOTE_SERVICE_EXCEPTION);
                 } else {
@@ -794,7 +797,7 @@
             } catch (RemoteException ex) {
                 log("Could not connect to Subscription Service");
                 if (Compatibility.isChangeEnabled(
-                        OpportunisticNetworkService.CALLBACK_ON_MORE_ERROR_CODE_CHANGE)) {
+                        TelephonyManager.CALLBACK_ON_MORE_ERROR_CODE_CHANGE)) {
                     sendSetOpptCallbackHelper(callbackStub,
                             TelephonyManager.SET_OPPORTUNISTIC_SUB_REMOTE_SERVICE_EXCEPTION);
                 } else {
@@ -807,7 +810,7 @@
         } else {
             log("Inactive sub passed for preferred data " + subId);
             if (Compatibility.isChangeEnabled(
-                    OpportunisticNetworkService.CALLBACK_ON_MORE_ERROR_CODE_CHANGE)) {
+                    TelephonyManager.CALLBACK_ON_MORE_ERROR_CODE_CHANGE)) {
                 if (isOpprotunisticSub(subId)) {
                     sendSetOpptCallbackHelper(callbackStub,
                             TelephonyManager.SET_OPPORTUNISTIC_SUB_INACTIVE_SUBSCRIPTION);
diff --git a/src/com/android/ons/OpportunisticNetworkService.java b/src/com/android/ons/OpportunisticNetworkService.java
index 58fbe06..7cb3238 100644
--- a/src/com/android/ons/OpportunisticNetworkService.java
+++ b/src/com/android/ons/OpportunisticNetworkService.java
@@ -18,8 +18,6 @@
 
 import android.app.Service;
 import android.compat.Compatibility;
-import android.compat.annotation.ChangeId;
-import android.compat.annotation.EnabledAfter;
 import android.content.BroadcastReceiver;
 import android.content.Context;
 import android.content.Intent;
@@ -27,7 +25,6 @@
 import android.content.SharedPreferences;
 import android.content.pm.PackageManager;
 import android.os.Binder;
-import android.os.Build;
 import android.os.Handler;
 import android.os.IBinder;
 import android.os.Message;
@@ -77,14 +74,6 @@
     private static final int MSG_SIM_STATE_CHANGE = 1;
 
     /**
-     * To expand the error codes for {@link TelephonyManager#updateAvailableNetworks} and
-     * {@link TelephonyManager#setPreferredOpportunisticDataSubscription}.
-     */
-    @ChangeId
-    @EnabledAfter(targetSdkVersion = Build.VERSION_CODES.Q)
-    static final long CALLBACK_ON_MORE_ERROR_CODE_CHANGE = 130595455L;
-
-    /**
      * Profile selection callback. Will be called once Profile selector decides on
      * the opportunistic data profile.
      */
@@ -399,7 +388,8 @@
             /* carrier apps should report only subscription */
             if (availableNetworks.size() > 1) {
                 log("Carrier app should not pass more than one subscription");
-                if (Compatibility.isChangeEnabled(CALLBACK_ON_MORE_ERROR_CODE_CHANGE)) {
+                if (Compatibility.isChangeEnabled(
+                        TelephonyManager.CALLBACK_ON_MORE_ERROR_CODE_CHANGE)) {
                     sendUpdateNetworksCallbackHelper(callbackStub,
                             TelephonyManager
                                     .UPDATE_AVAILABLE_NETWORKS_MULTIPLE_NETWORKS_NOT_SUPPORTED);
@@ -412,7 +402,8 @@
 
             if (!mProfileSelector.hasOpprotunisticSub(availableNetworks)) {
                 log("No opportunistic subscriptions received");
-                if (Compatibility.isChangeEnabled(CALLBACK_ON_MORE_ERROR_CODE_CHANGE)) {
+                if (Compatibility.isChangeEnabled(
+                        TelephonyManager.CALLBACK_ON_MORE_ERROR_CODE_CHANGE)) {
                     sendUpdateNetworksCallbackHelper(callbackStub,
                             TelephonyManager
                                     .UPDATE_AVAILABLE_NETWORKS_NO_OPPORTUNISTIC_SUB_AVAILABLE);
@@ -455,7 +446,8 @@
                     /*  if carrier is reporting availability, then it takes higher priority. */
                     mProfileSelector.startProfileSelection(availableNetworks, callbackStub);
                 } else {
-                    if (Compatibility.isChangeEnabled(CALLBACK_ON_MORE_ERROR_CODE_CHANGE)) {
+                    if (Compatibility.isChangeEnabled(
+                            TelephonyManager.CALLBACK_ON_MORE_ERROR_CODE_CHANGE)) {
                         sendUpdateNetworksCallbackHelper(callbackStub,
                                 TelephonyManager.UPDATE_AVAILABLE_NETWORKS_SERVICE_IS_DISABLED);
                     } else {
@@ -521,7 +513,8 @@
                 /* all subscriptions should be opportunistic subscriptions */
                 if (!mProfileSelector.hasOpprotunisticSub(availableNetworks)) {
                     log("No opportunistic subscriptions received");
-                    if (Compatibility.isChangeEnabled(CALLBACK_ON_MORE_ERROR_CODE_CHANGE)) {
+                    if (Compatibility.isChangeEnabled(
+                            TelephonyManager.CALLBACK_ON_MORE_ERROR_CODE_CHANGE)) {
                         sendUpdateNetworksCallbackHelper(callbackStub,
                                 TelephonyManager
                                         .UPDATE_AVAILABLE_NETWORKS_NO_OPPORTUNISTIC_SUB_AVAILABLE);
@@ -540,7 +533,8 @@
                         mProfileSelector.startProfileSelection(availableNetworks, callbackStub);
                     }
                 } else {
-                    if (Compatibility.isChangeEnabled(CALLBACK_ON_MORE_ERROR_CODE_CHANGE)) {
+                    if (Compatibility.isChangeEnabled(
+                            TelephonyManager.CALLBACK_ON_MORE_ERROR_CODE_CHANGE)) {
                         sendUpdateNetworksCallbackHelper(callbackStub,
                                 TelephonyManager.UPDATE_AVAILABLE_NETWORKS_SERVICE_IS_DISABLED);
                     } else {