diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index 6fc60e9..a820da4 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -844,6 +844,8 @@
 
     private boolean mHasCurrentPermissionsRequest;
 
+    private boolean mAutoFillResetNeeded;
+
     private static native String getDlWarning();
 
     /** Return the intent that started this activity. */
@@ -1780,7 +1782,7 @@
         getApplication().dispatchActivityStopped(this);
         mTranslucentCallback = null;
         mCalled = true;
-        if (isFinishing() && AutoFillManager.isClientActive(getActivityToken())) {
+        if (isFinishing() && mAutoFillResetNeeded) {
             getSystemService(AutoFillManager.class).reset();
         }
     }
@@ -6746,8 +6748,6 @@
         mCurrentConfig = config;
 
         mWindow.setColorMode(info.colorMode);
-
-        AutoFillManager.addClient(token, this);
     }
 
     /** @hide */
@@ -7214,6 +7214,12 @@
         }
     }
 
+    /** @hide */
+    @Override
+    public void resetableStateAvailable() {
+        mAutoFillResetNeeded = true;
+    }
+
     class HostCallbacks extends FragmentHostCallback<Activity> {
         public HostCallbacks() {
             super(Activity.this /*activity*/);
diff --git a/core/java/android/app/ActivityManagerInternal.java b/core/java/android/app/ActivityManagerInternal.java
index 4e34552..fa64a0f 100644
--- a/core/java/android/app/ActivityManagerInternal.java
+++ b/core/java/android/app/ActivityManagerInternal.java
@@ -22,7 +22,6 @@
 import android.content.IIntentSender;
 import android.content.Intent;
 import android.content.res.Configuration;
-import android.net.NetworkPolicyManager.UidStateWithSeqObserver;
 import android.os.Bundle;
 import android.os.IBinder;
 import android.service.voice.IVoiceInteractionSession;
@@ -234,16 +233,4 @@
      * @see android.view.WindowManager.LayoutParams#TYPE_APPLICATION_OVERLAY
      */
     public abstract void setHasOverlayUi(int pid, boolean hasOverlayUi);
-
-    /**
-     * Set observer which listens to uid state changes. Uid state change along with the sequence
-     * number associated with it needs to be passed to {@link UidStateWithSeqObserver}.
-     */
-    public abstract void setUidStateWithSeqObserver(UidStateWithSeqObserver observer);
-
-    /**
-     * Notifies that NetworkPolicyManagerService has updated the network policy rules for
-     * a specific {@param uid} and {@param procStateSeq}.
-     */
-    public abstract void notifyNetworkPolicyRulesUpdated(int uid, long procStateSeq);
 }
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index be70dcd..7ff11ec 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -180,7 +180,6 @@
     public static final boolean DEBUG_CONFIGURATION = false;
     private static final boolean DEBUG_SERVICE = false;
     private static final boolean DEBUG_MEMORY_TRIM = false;
-    private static final boolean DEBUG_NETWORK = false;
     private static final boolean DEBUG_PROVIDER = false;
     private static final boolean DEBUG_ORDER = false;
     private static final long MIN_TIME_BETWEEN_GCS = 5*1000;
@@ -203,55 +202,6 @@
     // Whether to invoke an activity callback after delivering new configuration.
     private static final boolean REPORT_TO_ACTIVITY = true;
 
-    /**
-     * This is the time main thread waits for the NetworkPolicyManagerService to notify
-     * that network is unrestricted. After this the app components will be launched anyway.
-     */
-    private long mWaitForNetworkTimeoutMs;
-
-    /**
-     * This is only for logging purposes. This will help us identify if the waiting for network
-     * is responsible for any lag that user might see.
-     */
-    private static final int WAIT_FOR_NETWORK_THRESHOLD_MS = 100; // 0.1 sec
-
-    /**
-     * State indicating that there is no need for any blocking for network.
-     */
-    public static final int NETWORK_STATE_NO_CHANGE = 0;
-
-    /**
-     * State indicating that main thread should wait for ActivityManagerService to notify
-     * before the app components are launched.
-     */
-    public static final int NETWORK_STATE_BLOCK = 1;
-
-    /**
-     * State indicating that any threads waiting for ActivityManagerService to notify should
-     * be unblocked.
-     */
-    public static final int NETWORK_STATE_UNBLOCK = 2;
-
-    /**
-     * Constant for indicating a invalid sequence number.
-     */
-    public static final long INVALID_PROC_STATE_SEQ = -1;
-
-    /**
-     * Current sequence number associated with the process state change.
-     */
-    @GuardedBy("mNetworkPolicyLock")
-    private long mCurProcStateSeq;
-
-    /**
-     * Indicates whether any component being launched should block for network before
-     * proceeding.
-     */
-    @GuardedBy("mNetworkPolicyLock")
-    private boolean mShouldBlockForNetwork;
-
-    private Object mNetworkPolicyLock = new Object();
-
     private ContextImpl mSystemContext;
 
     static volatile IPackageManager sPackageManager;
@@ -1363,18 +1313,6 @@
         }
 
         @Override
-        public void setBlockForNetworkState(int blockState, long targetProcStateSeq) {
-            synchronized (mNetworkPolicyLock) {
-                if (blockState == NETWORK_STATE_UNBLOCK) {
-                    unblockForNetworkAccessLN(targetProcStateSeq);
-                } else if (blockState == NETWORK_STATE_BLOCK) {
-                    mShouldBlockForNetwork = true;
-                }
-                mCurProcStateSeq = targetProcStateSeq;
-            }
-        }
-
-        @Override
         public void scheduleInstallProvider(ProviderInfo provider) {
             sendMessage(H.INSTALL_PROVIDER, provider);
         }
@@ -1457,13 +1395,6 @@
         public void handleTrustStorageUpdate() {
             NetworkSecurityPolicy.getInstance().handleTrustStorageUpdate();
         }
-
-        @Override
-        public void notifyNetworkStateUpdated(long curProcStateSeq) {
-            synchronized (mNetworkPolicyLock) {
-                unblockForNetworkAccessLN(curProcStateSeq);
-            }
-        }
     }
 
     private int getLifecycleSeq() {
@@ -2163,79 +2094,6 @@
         }
     }
 
-    void blockForNetworkAccessInForegroundService(long procStateSeq) {
-        synchronized (mNetworkPolicyLock) {
-            if (mCurProcStateSeq >= procStateSeq) {
-                if (mShouldBlockForNetwork) {
-                    blockForNetworkAccessLN();
-                }
-            } else {
-                mCurProcStateSeq = procStateSeq;
-                mShouldBlockForNetwork = true;
-                blockForNetworkAccessLN();
-            }
-        }
-    }
-
-    /**
-     * Block for unrestricted network. It will register a listener to AMS and wait for it to
-     * notify that network policy rules are updated. This method is called before relevant app
-     * components are launched.
-     */
-    private void blockForNetworkAccessLN() {
-        try {
-            if (ActivityManager.getService().registerNetworkRulesUpdateListener(
-                    mAppThread, mCurProcStateSeq)) {
-                try {
-                    Slog.d(TAG, "Uid: " + mBoundApplication.appInfo.uid
-                            + " seq: " + mCurProcStateSeq
-                            + ". Blocking for network. callers: " + Debug.getCallers(3));
-                    final long blockStartTime = SystemClock.elapsedRealtime();
-                    mNetworkPolicyLock.wait(mWaitForNetworkTimeoutMs);
-                    final long totalWaitTime = (SystemClock.elapsedRealtime() - blockStartTime);
-                    if (totalWaitTime >= mWaitForNetworkTimeoutMs) {
-                        Slog.wtf(TAG, "Timed out waiting for the network rules to get updated."
-                                + " Uid: " + mBoundApplication.appInfo.uid + " seq: "
-                                + mCurProcStateSeq);
-                    } else if (totalWaitTime >= WAIT_FOR_NETWORK_THRESHOLD_MS) {
-                        Slog.d(TAG, "Waited for time greater than threshold."
-                                + " Uid: " + mBoundApplication.appInfo.uid + " seq: "
-                                + mCurProcStateSeq);
-                    }
-                    if (DEBUG_NETWORK) {
-                        Slog.d(TAG, "Uid: " + mBoundApplication.appInfo.uid
-                                + " seq: " + mCurProcStateSeq
-                                + ". Time waited for network: " + totalWaitTime);
-                    }
-                } catch (InterruptedException ignored) {
-                }
-            }
-        } catch (RemoteException ignored) {
-        }
-    }
-
-    public void checkAndBlockForNetworkAccess() {
-        synchronized (mNetworkPolicyLock) {
-            if (mWaitForNetworkTimeoutMs > 0 && mShouldBlockForNetwork) {
-                blockForNetworkAccessLN();
-            }
-        }
-    }
-
-    /**
-     * Unblock the main thread if it is waiting for network.
-     */
-    private void unblockForNetworkAccessLN(long procStateSeq) {
-        if (mShouldBlockForNetwork && procStateSeq >= mCurProcStateSeq) {
-            if (DEBUG_NETWORK) {
-                Slog.d(TAG, "Unblocking threads waiting for network. uid: "
-                        + mBoundApplication.appInfo.uid + " procStateSeq: " + procStateSeq);
-            }
-            mNetworkPolicyLock.notifyAll();
-            mShouldBlockForNetwork = false;
-        }
-    }
-
     ActivityThread() {
         mResourcesManager = ResourcesManager.getInstance();
     }
@@ -2828,7 +2686,6 @@
                     activity.mIntent = customIntent;
                 }
                 r.lastNonConfigurationInstances = null;
-                checkAndBlockForNetworkAccess();
                 activity.mStartedActivity = false;
                 int theme = r.activityInfo.getThemeResource();
                 if (theme != 0) {
@@ -5564,9 +5421,6 @@
         View.mDebugViewAttributes =
                 mCoreSettings.getInt(Settings.Global.DEBUG_VIEW_ATTRIBUTES, 0) != 0;
 
-        mWaitForNetworkTimeoutMs = mCoreSettings.getLong(
-                Settings.Global.WAIT_FOR_NETWORK_TIMEOUT_MS);
-
         /**
          * For system applications on userdebug/eng builds, log stack
          * traces of disk and network access to dropbox for analysis.
diff --git a/core/java/android/app/IActivityManager.aidl b/core/java/android/app/IActivityManager.aidl
index 6717491..8538330 100644
--- a/core/java/android/app/IActivityManager.aidl
+++ b/core/java/android/app/IActivityManager.aidl
@@ -199,7 +199,7 @@
     int getRequestedOrientation(in IBinder token);
     void unbindFinished(in IBinder token, in Intent service, boolean doRebind);
     void setProcessForeground(in IBinder token, int pid, boolean isForeground);
-    long setServiceForeground(in ComponentName className, in IBinder token,
+    void setServiceForeground(in ComponentName className, in IBinder token,
             int id, in Notification notification, int flags);
     boolean moveActivityTaskToBack(in IBinder token, boolean nonRoot);
     void getMemoryInfo(out ActivityManager.MemoryInfo outInfo);
@@ -604,16 +604,6 @@
     ActivityManager.TaskSnapshot getTaskSnapshot(int taskId);
 
     void scheduleApplicationInfoChanged(in List<String> packageNames, int userId);
-     /**
-      * Registers a listener for network rules state. When the network policy rules in
-      * NetworkPolicyManagerService are updated, ActivityManagerService will notify these
-      * registered listeners.
-      *
-      * @param procStateSeq The sequence number for which the listener is interested in knowing
-      *                     the network policy rules state.
-      * @return true if the listener is registered, false otherwise.
-      */
-    boolean registerNetworkRulesUpdateListener(IApplicationThread listener, long procStateSeq);
 
     // WARNING: when these transactions are updated, check if they are any callers on the native
     // side. If so, make sure they are using the correct transaction ids and arguments.
diff --git a/core/java/android/app/IApplicationThread.aidl b/core/java/android/app/IApplicationThread.aidl
index 1735572..d5b4668 100644
--- a/core/java/android/app/IApplicationThread.aidl
+++ b/core/java/android/app/IApplicationThread.aidl
@@ -154,6 +154,4 @@
     void handleTrustStorageUpdate();
     void attachAgent(String path);
     void scheduleApplicationInfoChanged(in ApplicationInfo ai);
-    void setBlockForNetworkState(int blockState, long procStateSeq);
-    void notifyNetworkStateUpdated(long procStateSeq);
 }
diff --git a/core/java/android/app/Service.java b/core/java/android/app/Service.java
index 9cd048e..4fe4f98 100644
--- a/core/java/android/app/Service.java
+++ b/core/java/android/app/Service.java
@@ -683,28 +683,26 @@
      * flag if killing your service would be disruptive to the user, such as
      * if your service is performing background music playback, so the user
      * would notice if their music stopped playing.
-     *
+     * 
      * <p>If you need your application to run on platform versions prior to API
      * level 5, you can use the following model to call the the older setForeground()
      * or this modern method as appropriate:
-     *
+     * 
      * {@sample development/samples/ApiDemos/src/com/example/android/apis/app/ForegroundService.java
      *   foreground_compatibility}
-     *
+     * 
      * @param id The identifier for this notification as per
      * {@link NotificationManager#notify(int, Notification)
      * NotificationManager.notify(int, Notification)}; must not be 0.
      * @param notification The Notification to be displayed.
-     *
+     * 
      * @see #stopForeground(boolean)
      */
     public final void startForeground(int id, Notification notification) {
         try {
-            final long procStateSeq = mActivityManager.setServiceForeground(
-                    new ComponentName(this, mClassName), mToken, id, notification, 0);
-            if (procStateSeq != ActivityThread.INVALID_PROC_STATE_SEQ && mThread != null) {
-                mThread.blockForNetworkAccessInForegroundService(procStateSeq);
-            }
+            mActivityManager.setServiceForeground(
+                    new ComponentName(this, mClassName), mToken, id,
+                    notification, 0);
         } catch (RemoteException ex) {
         }
     }
diff --git a/core/java/android/net/NetworkPolicyManager.java b/core/java/android/net/NetworkPolicyManager.java
index 4b184f1..1b715af 100644
--- a/core/java/android/net/NetworkPolicyManager.java
+++ b/core/java/android/net/NetworkPolicyManager.java
@@ -19,7 +19,6 @@
 import static android.content.pm.PackageManager.GET_SIGNATURES;
 import static android.net.NetworkPolicy.CYCLE_NONE;
 
-import android.app.ActivityManager;
 import android.content.Context;
 import android.content.Intent;
 import android.content.pm.PackageManager;
@@ -66,8 +65,6 @@
      *
      * See network-policy-restrictions.md for more info.
      */
-    /** Not a valid rule */
-    public static final int RULE_INVALID = -1;
     /** No specific rule was set */
     public static final int RULE_NONE = 0;
     /** Allow traffic on metered networks. */
@@ -363,8 +360,6 @@
         final StringBuilder string = new StringBuilder().append(uidRules).append(" (");
         if (uidRules == RULE_NONE) {
             string.append("NONE");
-        } else if (uidRules == RULE_INVALID) {
-            string.append("INVALID");
         } else {
             string.append(DebugUtils.flagsToString(NetworkPolicyManager.class, "RULE_", uidRules));
         }
@@ -386,25 +381,4 @@
         string.append(")");
         return string.toString();
     }
-
-    /**
-     * @hide
-     */
-    public static boolean isProcStateAllowedWhileIdleOrPowerSaveMode(int procState) {
-        return procState <= ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE;
-    }
-
-    /**
-     * @hide
-     */
-    public static boolean isProcStateAllowedWhileRestrictBackgroundOn(int procState) {
-        return procState <= ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE;
-    }
-
-    /**
-     * @hide
-     */
-    public interface UidStateWithSeqObserver {
-        void onUidStateChangedWithSeq(int uid, int procState, long seq);
-    }
 }
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 0499476..1c6a77a 100755
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -9634,16 +9634,6 @@
         public static final String RETAIL_DEMO_MODE_CONSTANTS = "retail_demo_mode_constants";
 
         /**
-         * When blocked for the network policy rules to get updated, the maximum time that the
-         * {@link ActivityThread} have to wait before unblocking.
-         *
-         * Type: long
-         *
-         * @hide
-         */
-        public static final String WAIT_FOR_NETWORK_TIMEOUT_MS = "wait_for_network_timeout_ms";
-
-        /**
          * The reason for the settings database being downgraded. This is only for
          * troubleshooting purposes and its value should not be interpreted in any way.
          *
@@ -10227,6 +10217,13 @@
          * @hide
          */
         public static final String ENABLE_DISKSTATS_LOGGING = "enable_diskstats_logging";
+
+        /**
+         * Whether the cache quota calculation task is enabled/disabled.
+         * @hide
+         */
+        public static final String ENABLE_CACHE_QUOTA_CALCULATION =
+                "enable_cache_quota_calculation";
     }
 
     /**
diff --git a/core/java/android/view/autofill/AutoFillManager.java b/core/java/android/view/autofill/AutoFillManager.java
index 2168444..baba389 100644
--- a/core/java/android/view/autofill/AutoFillManager.java
+++ b/core/java/android/view/autofill/AutoFillManager.java
@@ -23,10 +23,8 @@
 import android.content.IntentSender;
 import android.graphics.Rect;
 import android.os.Bundle;
-import android.os.IBinder;
 import android.os.Parcelable;
 import android.os.RemoteException;
-import android.util.ArrayMap;
 import android.util.Log;
 import android.view.View;
 
@@ -70,13 +68,6 @@
     /** @hide */ public static final int FLAG_FOCUS_LOST = 0x4;
     /** @hide */ public static final int FLAG_VALUE_CHANGED = 0x8;
 
-    // These are activities that may have auto-fill UI which are keyed off their tokens.
-    // This is done instead of the activity setting the client in the auto-fill manager
-    // to avoid unnecessary instantiation of the manager and do this only if there is an
-    // auto-fillable focused. This has only the cost of loading the class vs creating an
-    // auto-fill manager for every activity even one that cannot be filled.
-    private static final ArrayMap<IBinder, AutoFillClient> sPendingClients = new ArrayMap<>();
-
     private final Rect mTempRect = new Rect();
 
     private final IAutoFillManager mService;
@@ -84,8 +75,6 @@
 
     private Context mContext;
 
-    private AutoFillClient mClient;
-
     private boolean mHasSession;
     private boolean mEnabled;
 
@@ -106,6 +95,11 @@
          * @param fillInIntent The authentication fill-in intent.
          */
         void authenticate(IntentSender intent, Intent fillInIntent);
+
+        /**
+         * Tells the client this manager has state to be reset.
+         */
+        void resetableStateAvailable();
     }
 
     /**
@@ -219,25 +213,11 @@
         finishSession();
     }
 
-    /** @hide */
-    public static void addClient(IBinder token, AutoFillClient client) {
-        sPendingClients.put(token, client);
-    }
-
-    /** @hide */
-    public static boolean isClientActive(IBinder token) {
-        return !sPendingClients.containsKey(token);
-    }
-
-    private void activateClient() {
-        mClient = sPendingClients.remove(mContext.getActivityToken());
-    }
-
     private AutoFillClient getClient() {
-        if (mClient == null) {
-            return sPendingClients.get(mContext.getActivityToken());
+        if (mContext instanceof AutoFillClient) {
+            return (AutoFillClient) mContext;
         }
-        return mClient;
+        return null;
     }
 
     /** @hide */
@@ -278,8 +258,11 @@
         try {
             mService.startSession(mContext.getActivityToken(), mServiceClient.asBinder(),
                     id, bounds, value, mContext.getUserId());
+            AutoFillClient client = getClient();
+            if (client != null) {
+                client.resetableStateAvailable();
+            }
             mHasSession = true;
-            activateClient();
         } catch (RemoteException e) {
             throw e.rethrowFromSystemServer();
         }
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 9e911632..bf8de38 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -5219,6 +5219,9 @@
 
         if (needEditableForNotification) {
             sendAfterTextChanged((Editable) text);
+        } else {
+            // Always notify AutoFillManager - it will return right away if auto-fill is disabled.
+            notifyAutoFillManagerAfterTextChanged();
         }
 
         // SelectionModifierCursorController depends on textCanBeSelected, which depends on text
@@ -9111,15 +9114,19 @@
         }
 
         // Always notify AutoFillManager - it will return right away if auto-fill is disabled.
+        notifyAutoFillManagerAfterTextChanged();
+
+        hideErrorIfUnchanged();
+    }
+
+    private void notifyAutoFillManagerAfterTextChanged() {
         final AutoFillManager afm = mContext.getSystemService(AutoFillManager.class);
         if (afm != null) {
             if (DEBUG_AUTOFILL) {
-                Log.v(LOG_TAG, "sendAfterTextChanged(): notify AFM for text=" + text);
+                Log.v(LOG_TAG, "sendAfterTextChanged(): notify AFM for text=" + mText);
             }
             afm.valueChanged(TextView.this);
         }
-
-        hideErrorIfUnchanged();
     }
 
     void updateAfterEdit() {
diff --git a/core/tests/coretests/src/android/provider/SettingsBackupTest.java b/core/tests/coretests/src/android/provider/SettingsBackupTest.java
index 8e29d63..da6a294 100644
--- a/core/tests/coretests/src/android/provider/SettingsBackupTest.java
+++ b/core/tests/coretests/src/android/provider/SettingsBackupTest.java
@@ -179,6 +179,7 @@
                     Settings.Global.DROPBOX_TAG_PREFIX,
                     Settings.Global.EMERGENCY_AFFORDANCE_NEEDED,
                     Settings.Global.ENABLE_ACCESSIBILITY_GLOBAL_GESTURE_ENABLED,
+                    Settings.Global.ENABLE_CACHE_QUOTA_CALCULATION,
                     Settings.Global.ENABLE_CELLULAR_ON_BOOT,
                     Settings.Global.ENABLE_DISKSTATS_LOGGING,
                     Settings.Global.ENABLE_EPHEMERAL_FEATURE,
@@ -324,7 +325,6 @@
                     Settings.Global.USE_GOOGLE_MAIL,
                     Settings.Global.VT_IMS_ENABLED,
                     Settings.Global.WAIT_FOR_DEBUGGER,
-                    Settings.Global.WAIT_FOR_NETWORK_TIMEOUT_MS,
                     Settings.Global.WARNING_TEMPERATURE,
                     Settings.Global.WEBVIEW_DATA_REDUCTION_PROXY_KEY,
                     Settings.Global.WEBVIEW_FALLBACK_LOGIC_ENABLED,
diff --git a/services/autofill/java/com/android/server/autofill/AutoFillManagerServiceImpl.java b/services/autofill/java/com/android/server/autofill/AutoFillManagerServiceImpl.java
index 55e00ed..ec3d356 100644
--- a/services/autofill/java/com/android/server/autofill/AutoFillManagerServiceImpl.java
+++ b/services/autofill/java/com/android/server/autofill/AutoFillManagerServiceImpl.java
@@ -726,7 +726,7 @@
                         Slog.d(TAG, "finishSessionLocked(): found a change on " + id + ": "
                                 + state.mAutoFillValue);
                     }
-                    mUi.showSaveUi();
+                    getUiForShowing().showSaveUi();
                     return;
                 }
             }
diff --git a/services/autofill/java/com/android/server/autofill/AutoFillUI.java b/services/autofill/java/com/android/server/autofill/AutoFillUI.java
index 78dd247..ee485df 100644
--- a/services/autofill/java/com/android/server/autofill/AutoFillUI.java
+++ b/services/autofill/java/com/android/server/autofill/AutoFillUI.java
@@ -75,9 +75,11 @@
 
     void setCallbackLocked(AutoFillUiCallback callback, IBinder activityToken) {
         mHandler.post(() -> {
-            hideAllUiThread();
-            mCallback = callback;
-            mActivityToken = activityToken;
+            if (callback != mCallback && activityToken != mActivityToken) {
+                hideAllUiThread();
+                mCallback = callback;
+                mActivityToken = activityToken;
+            }
         });
     }
 
diff --git a/services/core/java/com/android/server/am/ActiveServices.java b/services/core/java/com/android/server/am/ActiveServices.java
index cec5800..2bc131f 100644
--- a/services/core/java/com/android/server/am/ActiveServices.java
+++ b/services/core/java/com/android/server/am/ActiveServices.java
@@ -703,27 +703,21 @@
         return false;
     }
 
-    public long setServiceForegroundLocked(ComponentName className, IBinder token,
+    public void setServiceForegroundLocked(ComponentName className, IBinder token,
             int id, Notification notification, int flags) {
         final int userId = UserHandle.getCallingUserId();
         final long origId = Binder.clearCallingIdentity();
         try {
             ServiceRecord r = findServiceLocked(className, token, userId);
             if (r != null) {
-                return setServiceForegroundInnerLocked(r, id, notification, flags);
+                setServiceForegroundInnerLocked(r, id, notification, flags);
             }
-            return ActivityThread.INVALID_PROC_STATE_SEQ;
         } finally {
             Binder.restoreCallingIdentity(origId);
         }
     }
 
-    /**
-     * @return current process state sequence number {@link UidRecord#curProcStateSeq} corresponding
-     *         to the ServiceRecord {@param r} if the calling service has to block until the
-     *         network rules are udpated, Otherwise {@link ActivityThread#INVALID_PROC_STATE_SEQ}.
-     */
-    private long setServiceForegroundInnerLocked(ServiceRecord r, int id,
+    private void setServiceForegroundInnerLocked(ServiceRecord r, int id,
             Notification notification, int flags) {
         if (id != 0) {
             if (notification == null) {
@@ -742,7 +736,7 @@
                         Slog.w(TAG, "Instant app " + r.appInfo.packageName
                                 + " does not have permission to create foreground services"
                                 + ", ignoring.");
-                        return ActivityThread.INVALID_PROC_STATE_SEQ;
+                        return;
                     case AppOpsManager.MODE_ERRORED:
                         throw new SecurityException("Instant app " + r.appInfo.packageName
                                 + " does not have permission to create foreground services");
@@ -770,18 +764,12 @@
             r.foregroundNoti = notification;
             r.isForeground = true;
             r.postNotification();
-            long procStateSeqToReturn = ActivityThread.INVALID_PROC_STATE_SEQ;
             if (r.app != null) {
                 updateServiceForegroundLocked(r.app, true);
-                if (r.app.uidRecord != null &&
-                        r.app.uidRecord.blockState == ActivityThread.NETWORK_STATE_BLOCK) {
-                    procStateSeqToReturn = r.app.uidRecord.curProcStateSeq;
-                }
             }
             getServiceMapLocked(r.userId).ensureNotStartingBackgroundLocked(r);
             mAm.notifyPackageUse(r.serviceInfo.packageName,
                                  PackageManager.NOTIFY_PACKAGE_USE_FOREGROUND_SERVICE);
-            return procStateSeqToReturn;
         } else {
             if (r.isForeground) {
                 r.isForeground = false;
@@ -802,7 +790,6 @@
                 }
             }
         }
-        return ActivityThread.INVALID_PROC_STATE_SEQ;
     }
 
     private void cancelForegroudNotificationLocked(ServiceRecord r) {
diff --git a/services/core/java/com/android/server/am/ActivityManagerDebugConfig.java b/services/core/java/com/android/server/am/ActivityManagerDebugConfig.java
index 8ed95ee..88e0d03 100644
--- a/services/core/java/com/android/server/am/ActivityManagerDebugConfig.java
+++ b/services/core/java/com/android/server/am/ActivityManagerDebugConfig.java
@@ -63,7 +63,6 @@
     static final boolean DEBUG_LOCKTASK = DEBUG_ALL || false;
     static final boolean DEBUG_LRU = DEBUG_ALL || false;
     static final boolean DEBUG_MU = DEBUG_ALL || false;
-    static final boolean DEBUG_NETWORK = DEBUG_ALL || false;
     static final boolean DEBUG_OOM_ADJ = DEBUG_ALL || false;
     static final boolean DEBUG_PAUSE = DEBUG_ALL || false;
     static final boolean DEBUG_POWER = DEBUG_ALL || false;
@@ -108,7 +107,6 @@
     static final String POSTFIX_LOCKTASK = (APPEND_CATEGORY_NAME) ? "_LockTask" : "";
     static final String POSTFIX_LRU = (APPEND_CATEGORY_NAME) ? "_LRU" : "";
     static final String POSTFIX_MU = "_MU";
-    static final String POSTFIX_NETWORK = "_Network";
     static final String POSTFIX_OOM_ADJ = (APPEND_CATEGORY_NAME) ? "_OomAdj" : "";
     static final String POSTFIX_PAUSE = (APPEND_CATEGORY_NAME) ? "_Pause" : "";
     static final String POSTFIX_POWER = (APPEND_CATEGORY_NAME) ? "_Power" : "";
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index aaed0e9..7a3326b 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -42,9 +42,6 @@
 import static android.content.pm.PackageManager.MATCH_UNINSTALLED_PACKAGES;
 import static android.content.pm.PackageManager.PERMISSION_GRANTED;
 import static android.content.res.Configuration.UI_MODE_TYPE_TELEVISION;
-import static android.net.NetworkPolicyManager.isProcStateAllowedWhileIdleOrPowerSaveMode;
-import static android.net.NetworkPolicyManager.isProcStateAllowedWhileRestrictBackgroundOn;
-import static android.net.NetworkPolicyManager.UidStateWithSeqObserver;
 import static android.os.Build.VERSION_CODES.N;
 import static android.os.Process.PROC_CHAR;
 import static android.os.Process.PROC_OUT_LONG;
@@ -79,7 +76,6 @@
 import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_LOCKTASK;
 import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_LRU;
 import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_MU;
-import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_NETWORK;
 import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_OOM_ADJ;
 import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_PERMISSIONS_REVIEW;
 import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_POWER;
@@ -109,7 +105,6 @@
 import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_LOCKTASK;
 import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_LRU;
 import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_MU;
-import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_NETWORK;
 import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_OOM_ADJ;
 import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_POWER;
 import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_PROCESSES;
@@ -361,7 +356,6 @@
 import com.android.server.Watchdog;
 import com.android.server.am.ActivityStack.ActivityState;
 import com.android.server.firewall.IntentFirewall;
-import com.android.server.net.NetworkPolicyManagerService;
 import com.android.server.pm.Installer;
 import com.android.server.pm.Installer.InstallerException;
 import com.android.server.statusbar.StatusBarManagerInternal;
@@ -418,7 +412,6 @@
     private static final String TAG_LOCKTASK = TAG + POSTFIX_LOCKTASK;
     private static final String TAG_LRU = TAG + POSTFIX_LRU;
     private static final String TAG_MU = TAG + POSTFIX_MU;
-    private static final String TAG_NETWORK = TAG + POSTFIX_NETWORK;
     private static final String TAG_OOM_ADJ = TAG + POSTFIX_OOM_ADJ;
     private static final String TAG_POWER = TAG + POSTFIX_POWER;
     private static final String TAG_PROCESS_OBSERVERS = TAG + POSTFIX_PROCESS_OBSERVERS;
@@ -605,8 +598,6 @@
     BroadcastStats mLastBroadcastStats;
     BroadcastStats mCurBroadcastStats;
 
-    private UidStateWithSeqObserver mUidStateWithSeqObserver;
-
     BroadcastQueue broadcastQueueForIntent(Intent intent) {
         final boolean isFg = (intent.getFlags() & Intent.FLAG_RECEIVER_FOREGROUND) != 0;
         if (DEBUG_BROADCAST_BACKGROUND) Slog.i(TAG_BROADCAST,
@@ -4231,25 +4222,6 @@
                     "*** Delivering " + N + " uid changes");
         }
 
-        if (mUidStateWithSeqObserver != null) {
-            final int registeredCallbackCount = mUidObservers.getRegisteredCallbackCount();
-            for (int i = 0; i < N; ++i) {
-                final UidRecord.ChangeItem item = mActiveUidChanges[i];
-                if (item.change == UidRecord.CHANGE_PROCSTATE) {
-                    mUidStateWithSeqObserver.onUidStateChangedWithSeq(
-                            item.uid, item.processState, item.procStateSeq);
-                    if (VALIDATE_UID_STATES && registeredCallbackCount == 0) {
-                        UidRecord validateUid = mValidateUids.get(item.uid);
-                        if (validateUid == null) {
-                            validateUid = new UidRecord(item.uid);
-                            mValidateUids.put(item.uid, validateUid);
-                        }
-                        validateUid.curProcState = validateUid.setProcState = item.processState;
-                    }
-                }
-            }
-        }
-
         int i = mUidObservers.beginBroadcast();
         while (i > 0) {
             i--;
@@ -17626,16 +17598,11 @@
         }
     }
 
-    /**
-     * Returns sequence number associated with the current process state change if the service
-     * coming to the foreground needs to block for network before proceeding, otherwise
-     * {@link ActivityThread#INVALID_PROC_STATE_SEQ}.
-     */
     @Override
-    public long setServiceForeground(ComponentName className, IBinder token,
+    public void setServiceForeground(ComponentName className, IBinder token,
             int id, Notification notification, int flags) {
         synchronized(this) {
-            return mServices.setServiceForegroundLocked(className, token, id, notification, flags);
+            mServices.setServiceForegroundLocked(className, token, id, notification, flags);
         }
     }
 
@@ -21396,7 +21363,6 @@
         pendingChange.processState = uidRec != null
                 ? uidRec.setProcState : ActivityManager.PROCESS_STATE_NONEXISTENT;
         pendingChange.ephemeral = uidRec.ephemeral;
-        pendingChange.procStateSeq = uidRec.curProcStateSeq;
 
         // Directly update the power manager, since we sit on top of it and it is critical
         // it be kept in sync (so wake locks will be held as soon as appropriate).
@@ -21770,34 +21736,6 @@
             }
         }
 
-        for (int i = mActiveUids.size() - 1; i >= 0; --i) {
-            final UidRecord uidRec = mActiveUids.valueAt(i);
-            uidRec.shouldNotifyAppThreads = false;
-            if (uidRec.curProcState == uidRec.setProcState) {
-                continue;
-            }
-            final int newBlockState = getUidRecordBlockState(uidRec);
-            // Sequence no. associated with process state change will only be updated if the
-            // process is coming from background to foreground or vice versa.
-            if (newBlockState != uidRec.blockState) {
-                uidRec.blockState = newBlockState;
-                uidRec.curProcStateSeq++;
-                uidRec.appThreadListeners = null;
-                uidRec.shouldNotifyAppThreads = true;
-            }
-        }
-
-        for (int i = mLruProcesses.size() - 1; i >= 0; --i) {
-            final ProcessRecord app = mLruProcesses.get(i);
-            if (!app.killedByAm && app.thread != null && app.uidRecord.shouldNotifyAppThreads) {
-                try {
-                    app.thread.setBlockForNetworkState(app.uidRecord.blockState,
-                            app.uidRecord.curProcStateSeq);
-                } catch (RemoteException ignored) {
-                }
-            }
-        }
-
         mNumServiceProcs = mNewNumServiceProcs;
 
         // Now determine the memory trimming level of background processes.
@@ -22999,131 +22937,6 @@
                 updateOomAdjLocked(pr);
             }
         }
-
-        @Override
-        public void setUidStateWithSeqObserver(UidStateWithSeqObserver observer) {
-            synchronized (ActivityManagerService.this) {
-                mUidStateWithSeqObserver = observer;
-            }
-        }
-
-        @Override
-        public void notifyNetworkPolicyRulesUpdated(int uid, long procStateSeq) {
-            if (DEBUG_NETWORK) {
-                Slog.d(TAG_NETWORK, "Got update from NPMS uid: " + uid + " seq: " + procStateSeq);
-            }
-            synchronized (ActivityManagerService.this) {
-                final UidRecord record = mActiveUids.get(uid);
-                if (record == null) {
-                    if (DEBUG_NETWORK) {
-                        Slog.d(TAG_NETWORK, "No active uidRecord for uid: " + uid
-                                + "seq: " + procStateSeq);
-                    }
-                    return;
-                }
-                record.lastProcStateSeqWithUpdatedNetworkState = procStateSeq;
-                if (record.curProcStateSeq > procStateSeq) {
-                    if (DEBUG_NETWORK) {
-                        Slog.d(TAG_NETWORK, "Since the current procStateSeq is greater, the "
-                                + "listeners would already be notified when it is incremented.");
-                    }
-                    return;
-                }
-
-                if (record.appThreadListeners == null) {
-                    if (DEBUG_NETWORK) {
-                        Slog.d(TAG_NETWORK, "No app thread listeners for uid: " + uid
-                                + "seq: " + procStateSeq);
-                    }
-                    return;
-                }
-                for (int i = record.appThreadListeners.beginBroadcast() - 1; i >= 0; i--) {
-                    final IApplicationThread listener =
-                            record.appThreadListeners.getBroadcastItem(i);
-                    try {
-                        if (listener != null) {
-                            listener.notifyNetworkStateUpdated(procStateSeq);
-                        }
-                    } catch (RemoteException ignored) {
-                    }
-                }
-                record.appThreadListeners.finishBroadcast();
-                record.appThreadListeners = null;
-            }
-        }
-    }
-
-    @Override
-    public boolean registerNetworkRulesUpdateListener(IApplicationThread listener,
-            long procStateSeq) {
-        synchronized (this) {
-            final int uid = Binder.getCallingUid();
-            final UidRecord record = mActiveUids.get(uid);
-            if (record.lastProcStateSeqWithUpdatedNetworkState >= procStateSeq) {
-                if (DEBUG_NETWORK) {
-                    Slog.v(TAG_NETWORK, "Network state is already updated for seq: " + procStateSeq
-                            + ". No need to register listener for uid: " + uid);
-                }
-                return false;
-            }
-            if (record.curProcStateSeq > procStateSeq) {
-                if (DEBUG_NETWORK) {
-                    Slog.v(TAG_NETWORK, "Since the current procState is greater, there is no need "
-                            + " to register listeners for older seq numbers");
-                }
-            }
-            if (record.appThreadListeners == null) {
-                record.appThreadListeners = new RemoteCallbackList<>();
-            }
-            record.appThreadListeners.register(listener);
-            if (DEBUG_NETWORK) {
-                Slog.v(TAG_NETWORK, "Registered listener for uid: " + uid + " seq: " + procStateSeq);
-            }
-            return true;
-        }
-    }
-
-    private int getUidRecordBlockState(UidRecord uidRec) {
-        final boolean curStateAllowedWhileRestrictBackgroundOn
-                = isProcStateAllowedWhileRestrictBackgroundOn(uidRec.curProcState);
-        final boolean curStateAllowedWhileIdleOrPowerSaveMode
-                = isProcStateAllowedWhileIdleOrPowerSaveMode(uidRec.curProcState);
-
-        if (uidRec.setProcState == ActivityManager.PROCESS_STATE_UNKNOWN) {
-            if (uidRec.curProcState != ActivityManager.PROCESS_STATE_UNKNOWN &&
-                    (curStateAllowedWhileIdleOrPowerSaveMode
-                            || curStateAllowedWhileRestrictBackgroundOn)) {
-                return ActivityThread.NETWORK_STATE_BLOCK;
-            }
-            return ActivityThread.NETWORK_STATE_NO_CHANGE;
-        }
-
-        final boolean prevStateAllowedWhileRestrictBackgroundOn
-                = isProcStateAllowedWhileRestrictBackgroundOn(uidRec.setProcState);
-        final boolean prevStateAllowedWhileIdleOrPowerSaveMode
-                = isProcStateAllowedWhileIdleOrPowerSaveMode(uidRec.setProcState);
-
-        if (prevStateAllowedWhileIdleOrPowerSaveMode == curStateAllowedWhileIdleOrPowerSaveMode &&
-                prevStateAllowedWhileRestrictBackgroundOn ==
-                        curStateAllowedWhileRestrictBackgroundOn) {
-            return uidRec.blockState;
-        }
-
-        if (!prevStateAllowedWhileIdleOrPowerSaveMode && curStateAllowedWhileIdleOrPowerSaveMode) {
-            return ActivityThread.NETWORK_STATE_BLOCK;
-        } else if (!prevStateAllowedWhileRestrictBackgroundOn
-                && curStateAllowedWhileRestrictBackgroundOn) {
-            return ActivityThread.NETWORK_STATE_BLOCK;
-        }
-
-        if (prevStateAllowedWhileIdleOrPowerSaveMode && !curStateAllowedWhileIdleOrPowerSaveMode) {
-            return ActivityThread.NETWORK_STATE_UNBLOCK;
-        } else if (prevStateAllowedWhileRestrictBackgroundOn &&
-                !curStateAllowedWhileRestrictBackgroundOn) {
-            return ActivityThread.NETWORK_STATE_UNBLOCK;
-        }
-
-        return uidRec.blockState;
     }
 
     private final class SleepTokenImpl extends SleepToken {
diff --git a/services/core/java/com/android/server/am/CoreSettingsObserver.java b/services/core/java/com/android/server/am/CoreSettingsObserver.java
index 9b459d1..73a17c6 100644
--- a/services/core/java/com/android/server/am/CoreSettingsObserver.java
+++ b/services/core/java/com/android/server/am/CoreSettingsObserver.java
@@ -49,7 +49,6 @@
         // add other system settings here...
 
         sGlobalSettingToTypeMap.put(Settings.Global.DEBUG_VIEW_ATTRIBUTES, int.class);
-        sGlobalSettingToTypeMap.put(Settings.Global.WAIT_FOR_NETWORK_TIMEOUT_MS, long.class);
         // add other global settings here...
     }
 
@@ -57,8 +56,6 @@
 
     private final ActivityManagerService mActivityManagerService;
 
-    private static final long WAIT_FOR_NETWORK_TIMEOUT_DEFAULT_MS = 2000; // 2 sec
-
     public CoreSettingsObserver(ActivityManagerService activityManagerService) {
         super(activityManagerService.mHandler);
         mActivityManagerService = activityManagerService;
@@ -146,13 +143,7 @@
                 } else if (map == sSystemSettingToTypeMap) {
                     value = Settings.System.getLong(context.getContentResolver(), setting, 0);
                 } else {
-                    // TODO: remove this conditional and set the default in settings provider.
-                    if (Settings.Global.WAIT_FOR_NETWORK_TIMEOUT_MS.equals(setting)) {
-                        value = Settings.Global.getLong(context.getContentResolver(), setting,
-                                WAIT_FOR_NETWORK_TIMEOUT_DEFAULT_MS);
-                    } else {
-                        value = Settings.Global.getLong(context.getContentResolver(), setting, 0);
-                    }
+                    value = Settings.Global.getLong(context.getContentResolver(), setting, 0);
                 }
                 snapshot.putLong(setting, value);
             }
diff --git a/services/core/java/com/android/server/am/UidRecord.java b/services/core/java/com/android/server/am/UidRecord.java
index 1e16bc9..302f628 100644
--- a/services/core/java/com/android/server/am/UidRecord.java
+++ b/services/core/java/com/android/server/am/UidRecord.java
@@ -17,12 +17,8 @@
 package com.android.server.am;
 
 import android.app.ActivityManager;
-import android.app.ActivityThread;
-import android.app.IApplicationThread;
-import android.os.RemoteCallbackList;
 import android.os.SystemClock;
 import android.os.UserHandle;
-import android.util.DebugUtils;
 import android.util.TimeUtils;
 
 /**
@@ -38,27 +34,6 @@
     boolean setWhitelist;
     boolean idle;
     int numProcs;
-    /**
-     * Seq no. associated with the current process state change (from background to foreground or
-     * vice versa).
-     */
-    long curProcStateSeq;
-    /**
-     * Latest seq number for which NetworkPolicyManagerService notified ActivityManagerService that
-     * network policy rules are updated.
-     */
-    long lastProcStateSeqWithUpdatedNetworkState;
-    /**
-     * Current block state indicating whether components in the process corresponding to this
-     * uidRecord needs to block for network or unblock or if there is no change.
-     * value will be one of {@link ActivityThread#NETWORK_STATE_BLOCK},
-     * {@link ActivityThread#NETWORK_STATE_UNBLOCK}, {@link ActivityThread#NETWORK_STATE_NO_CHANGE}.
-     */
-    int blockState;
-    /** Indicates whether app threads need be notified of the current blockState change. */
-    boolean shouldNotifyAppThreads;
-    /** Listeners waiting for the network policy rules to get updated. */
-    RemoteCallbackList<IApplicationThread> appThreadListeners;
 
     static final int CHANGE_PROCSTATE = 0;
     static final int CHANGE_GONE = 1;
@@ -72,7 +47,6 @@
         int change;
         int processState;
         boolean ephemeral;
-        long procStateSeq;
     }
 
     ChangeItem pendingChange;
@@ -109,14 +83,6 @@
         }
         sb.append(" procs:");
         sb.append(numProcs);
-        sb.append(" procStateSeq:");
-        sb.append(curProcStateSeq);
-        sb.append(" lastProcStateSeqWithUpdatedNetworkState:");
-        sb.append(lastProcStateSeqWithUpdatedNetworkState);
-        sb.append(" blockState:");
-        sb.append(DebugUtils.valueToString(ActivityThread.class, "NETWORK_STATE_", blockState));
-        sb.append(" shouldNotifyAppThreads:");
-        sb.append(shouldNotifyAppThreads);
         sb.append("}");
         return sb.toString();
     }
diff --git a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
index 91c9316..ac3a025 100644
--- a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
+++ b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
@@ -23,7 +23,6 @@
 import static android.Manifest.permission.READ_NETWORK_USAGE_HISTORY;
 import static android.Manifest.permission.READ_PHONE_STATE;
 import static android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE;
-import static android.app.ActivityThread.INVALID_PROC_STATE_SEQ;
 import static android.content.Intent.ACTION_PACKAGE_ADDED;
 import static android.content.Intent.ACTION_UID_REMOVED;
 import static android.content.Intent.ACTION_USER_ADDED;
@@ -54,15 +53,11 @@
 import static android.net.NetworkPolicyManager.RULE_ALLOW_METERED;
 import static android.net.NetworkPolicyManager.MASK_METERED_NETWORKS;
 import static android.net.NetworkPolicyManager.MASK_ALL_NETWORKS;
-import static android.net.NetworkPolicyManager.RULE_INVALID;
 import static android.net.NetworkPolicyManager.RULE_NONE;
 import static android.net.NetworkPolicyManager.RULE_REJECT_ALL;
 import static android.net.NetworkPolicyManager.RULE_REJECT_METERED;
 import static android.net.NetworkPolicyManager.RULE_TEMPORARY_ALLOW_METERED;
-import static android.net.NetworkPolicyManager.UidStateWithSeqObserver;
 import static android.net.NetworkPolicyManager.computeLastCycleBoundary;
-import static android.net.NetworkPolicyManager.isProcStateAllowedWhileIdleOrPowerSaveMode;
-import static android.net.NetworkPolicyManager.isProcStateAllowedWhileRestrictBackgroundOn;
 import static android.net.NetworkPolicyManager.uidPoliciesToString;
 import static android.net.NetworkPolicyManager.uidRulesToString;
 import static android.net.NetworkTemplate.MATCH_MOBILE_3G_LOWER;
@@ -99,7 +94,6 @@
 import android.annotation.IntDef;
 import android.annotation.Nullable;
 import android.app.ActivityManager;
-import android.app.ActivityManagerInternal;
 import android.app.AppGlobals;
 import android.app.AppOpsManager;
 import android.app.IActivityManager;
@@ -129,7 +123,6 @@
 import android.net.NetworkIdentity;
 import android.net.NetworkInfo;
 import android.net.NetworkPolicy;
-import android.net.NetworkPolicyManager;
 import android.net.NetworkQuotaInfo;
 import android.net.NetworkState;
 import android.net.NetworkTemplate;
@@ -137,7 +130,6 @@
 import android.net.wifi.WifiInfo;
 import android.net.wifi.WifiManager;
 import android.os.Binder;
-import android.os.Debug;
 import android.os.Environment;
 import android.os.Handler;
 import android.os.HandlerThread;
@@ -169,10 +161,8 @@
 import android.util.NtpTrustedTime;
 import android.util.Pair;
 import android.util.Slog;
-import android.util.SparseArray;
 import android.util.SparseBooleanArray;
 import android.util.SparseIntArray;
-import android.util.SparseLongArray;
 import android.util.TrustedTime;
 import android.util.Xml;
 
@@ -220,16 +210,14 @@
  * enforcement.
  *
  * <p>
- * This class uses 4 locks to synchronize state:
+ * This class uses 2-3 locks to synchronize state:
  * <ul>
  * <li>{@code mUidRulesFirstLock}: used to guard state related to individual UIDs (such as firewall
  * rules).
  * <li>{@code mNetworkPoliciesSecondLock}: used to guard state related to network interfaces (such
  * as network policies).
- * <li>{@code mDispatchedThirdLock}: used to guard state related to process state sequence numbers
- * of uids which are currently blocked waiting for network.
- * <li>{@code allLocks}: not a "real" lock, but an indication (through @GuardedBy) that both locks
- * {@code mUidRulesFirstLock} and {@code mNetworkPoliciesSecondLock} must be held.
+ * <li>{@code allLocks}: not a "real" lock, but an indication (through @GuardedBy) that all locks
+ * must be held.
  * </ul>
  *
  * <p>
@@ -237,11 +225,8 @@
  * <ul>
  * <li>{@code UL()}: require the "UID" lock ({@code mUidRulesFirstLock}).
  * <li>{@code NL()}: require the "Network" lock ({@code mNetworkPoliciesSecondLock}).
- * <li>{@code DL()}: require the "Dispatched" lock ({@code mDispatchedThirdLock}).
- * <li>{@code AL()}: require both locks {@code mUidRulesFirstLock} and
- * {@code mNetworkPoliciesSecondLock}.
- * When multiple locks are needed, they must be obtained in order ({@code mUidRulesFirstLock}
- * first, then {@code mNetworkPoliciesSecondLock}, then {@code mDispatchedThirdLock}, etc..
+ * <li>{@code AL()}: require all locks, which must be obtained in order ({@code mUidRulesFirstLock}
+ * first, then {@code mNetworkPoliciesSecondLock}, then {@code mYetAnotherGuardThirdLock}, etc..
  * </ul>
  */
 public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
@@ -328,27 +313,6 @@
     // See main javadoc for instructions on how to use these locks.
     final Object mUidRulesFirstLock = new Object();
     final Object mNetworkPoliciesSecondLock = new Object();
-    final Object mDispatchedThirdLock = new Object();
-
-    @GuardedBy("mDispatchedThirdLock")
-    private final SparseLongArray mLastHandledProcStateSeq = new SparseLongArray();
-
-    /**
-     * Used for tracking whether the updated uid and firewall rules have been dispatched to
-     * ConnectivityService and NetworkManagementService respectively.
-     *
-     * SparseIntArray: uid -> dispatch flags (one or more combinations of {@link #FLAG_NONE},
-     * {@link #FLAG_UID_RULES_DISPATCHED}, {@link #FLAG_FIREWALL_RULES_DISPATCHED} and
-     * {@link #FLAG_ALL_RULES_DISPATCHED}).
-     */
-    @GuardedBy("mDispatchedThirdLock")
-    private final SparseIntArray mDispatchFlagsForCurProcStateSeq = new SparseIntArray();
-
-    private final int FLAG_NONE = 0;
-    private final int FLAG_UID_RULES_DISPATCHED = 1 << 0;
-    private final int FLAG_FIREWALL_RULES_DISPATCHED = 1 << 1;
-    private final int FLAG_ALL_RULES_DISPATCHED =
-            (FLAG_UID_RULES_DISPATCHED | FLAG_FIREWALL_RULES_DISPATCHED);
 
     @GuardedBy("allLocks") volatile boolean mSystemReady;
 
@@ -443,8 +407,6 @@
 
     private final IPackageManager mIPm;
 
-    private ActivityManagerInternal mActivityManagerInternal;
-
 
     // TODO: keep whitelist of system-critical services that should never have
     // rules enforced, such as system, phone, and radio UIDs.
@@ -655,16 +617,13 @@
 
             try {
                 mActivityManager.registerUidObserver(mUidObserver,
-                        ActivityManager.UID_OBSERVER_GONE,
+                        ActivityManager.UID_OBSERVER_PROCSTATE|ActivityManager.UID_OBSERVER_GONE,
                         ActivityManager.PROCESS_STATE_UNKNOWN, null);
                 mNetworkManager.registerObserver(mAlertObserver);
             } catch (RemoteException e) {
                 // ignored; both services live in system_server
             }
 
-            mActivityManagerInternal = LocalServices.getService(ActivityManagerInternal.class);
-            mActivityManagerInternal.setUidStateWithSeqObserver(mUidStateWithSeqObserver);
-
             // listen for changes to power save whitelist
             final IntentFilter whitelistFilter = new IntentFilter(
                     PowerManager.ACTION_POWER_SAVE_WHITELIST_CHANGED);
@@ -746,24 +705,17 @@
         }
     }
 
-    final private UidStateWithSeqObserver mUidStateWithSeqObserver = new UidStateWithSeqObserver() {
-        @Override
-        public void onUidStateChangedWithSeq(int uid, int procState, long procStateSeq) {
+    final private IUidObserver mUidObserver = new IUidObserver.Stub() {
+        @Override public void onUidStateChanged(int uid, int procState) throws RemoteException {
             Trace.traceBegin(Trace.TRACE_TAG_NETWORK, "onUidStateChanged");
             try {
-                final long effectiveProcStateSeq = getEffectiveProcStateSeq(uid, procStateSeq);
                 synchronized (mUidRulesFirstLock) {
-                    updateUidStateUL(uid, procState, effectiveProcStateSeq);
+                    updateUidStateUL(uid, procState);
                 }
             } finally {
                 Trace.traceEnd(Trace.TRACE_TAG_NETWORK);
             }
         }
-    };
-
-    final private IUidObserver mUidObserver = new IUidObserver.Stub() {
-        @Override public void onUidStateChanged(int uid, int procState) throws RemoteException {
-        }
 
         @Override public void onUidGone(int uid, boolean disabled) throws RemoteException {
             synchronized (mUidRulesFirstLock) {
@@ -1890,7 +1842,7 @@
         }
 
         // uid policy changed, recompute rules and persist policy.
-        updateRulesForDataUsageRestrictionsUL(uid, true);
+        updateRulesForDataUsageRestrictionsUL(uid);
         if (persist) {
             synchronized (mNetworkPoliciesSecondLock) {
                 writePolicyAL();
@@ -2489,7 +2441,7 @@
 
     private boolean isUidForegroundOnRestrictBackgroundUL(int uid) {
         final int procState = mUidState.get(uid, ActivityManager.PROCESS_STATE_CACHED_EMPTY);
-        return isProcStateAllowedWhileRestrictBackgroundOn(procState);
+        return isProcStateAllowedWhileOnRestrictBackground(procState);
     }
 
     private boolean isUidForegroundOnRestrictPowerUL(int uid) {
@@ -2507,50 +2459,26 @@
      * {@link #updateRulesForDataUsageRestrictionsUL(int)} and
      * {@link #updateRulesForPowerRestrictionsUL(int)}
      */
-    private void updateUidStateUL(int uid, int uidState, long procStateSeq) {
+    private void updateUidStateUL(int uid, int uidState) {
         Trace.traceBegin(Trace.TRACE_TAG_NETWORK, "updateUidStateUL");
         try {
             final int oldUidState = mUidState.get(uid, ActivityManager.PROCESS_STATE_CACHED_EMPTY);
             if (oldUidState != uidState) {
                 // state changed, push updated rules
                 mUidState.put(uid, uidState);
-                if (procStateSeq != INVALID_PROC_STATE_SEQ) {
-                    int updatedUidRules = RULE_INVALID;
-                    ReturnStatus status = updateRestrictBackgroundRulesOnUidStatusChangedUL(
-                            uid, oldUidState, uidState, false);
-                    if (status != null && status.mNeedToNotify) {
-                        updatedUidRules = status.mNewUidRules;
+                updateRestrictBackgroundRulesOnUidStatusChangedUL(uid, oldUidState, uidState);
+                if (isProcStateAllowedWhileIdleOrPowerSaveMode(oldUidState)
+                        != isProcStateAllowedWhileIdleOrPowerSaveMode(uidState) ) {
+                    if (isUidIdle(uid)) {
+                        updateRuleForAppIdleUL(uid);
                     }
-                    final boolean procStateChangedAllowedWhileIdleOrPowerSaveMode =
-                            isProcStateAllowedWhileIdleOrPowerSaveMode(oldUidState)
-                                    != isProcStateAllowedWhileIdleOrPowerSaveMode(uidState);
-                    if (procStateChangedAllowedWhileIdleOrPowerSaveMode) {
-                        status = updateRulesForPowerRestrictionsUL(uid, false);
-                        if (status != null && status.mNeedToNotify) {
-                            updatedUidRules = status.mNewUidRules;
-                        }
+                    if (mDeviceIdleMode) {
+                        updateRuleForDeviceIdleUL(uid);
                     }
-                    // TODO: We can avoid this if the rules are not changed. But since dispatching
-                    // to ConnectivityService is currently asynchronous, we need this to make sure
-                    // any previous the msg_rules_changes have been handled. Optimize this once
-                    // dispatching from NPMS to ConnectivityService is made synchronous.
-                    mHandler.obtainMessage(MSG_RULES_CHANGED, uid, updatedUidRules,
-                            procStateSeq).sendToTarget();
-                    if (procStateChangedAllowedWhileIdleOrPowerSaveMode) {
-                        if (isUidIdle(uid)) {
-                            updateRuleForAppIdleUL(uid);
-                        }
-                        if (mDeviceIdleMode) {
-                            updateRuleForDeviceIdleUL(uid);
-                        }
-                        if (mRestrictPower) {
-                            updateRuleForRestrictPowerUL(uid);
-                        }
+                    if (mRestrictPower) {
+                        updateRuleForRestrictPowerUL(uid);
                     }
-                    synchronized (mDispatchedThirdLock) {
-                        setDispatchedFlagDL(uid, procStateSeq, FLAG_FIREWALL_RULES_DISPATCHED);
-                        checkAndNotifyDL(uid, procStateSeq);
-                    }
+                    updateRulesForPowerRestrictionsUL(uid);
                 }
                 updateNetworkStats(uid, isUidStateForegroundUL(uidState));
             }
@@ -2559,61 +2487,6 @@
         }
     }
 
-    /**
-     * Returns {@link android.app.ActivityThread#INVALID_PROC_STATE_SEQ} if acting on
-     * {@param procStateSeq} leads to an invalid state, otherwise update global state and return
-     * {@param procStateSeq}.
-     */
-    private long getEffectiveProcStateSeq(int uid, long procStateSeq) {
-        synchronized (mDispatchedThirdLock) {
-            final long lastHandledProcStateSeq = mLastHandledProcStateSeq.get(uid);
-            if (procStateSeq < lastHandledProcStateSeq) {
-                Slog.wtf(TAG, "procStateSeq from AMS should never go down, procStateSeq: "
-                        + procStateSeq + " lastHandledProcStateSeq: " + lastHandledProcStateSeq
-                        + " uid: " + uid);
-                return INVALID_PROC_STATE_SEQ;
-            }
-            if (procStateSeq == lastHandledProcStateSeq) {
-                if (LOGD) {
-                    Slog.d(TAG, "procStateSeq: " + procStateSeq + " is not changed, so process is "
-                            + "not jumping from background to foreground or vice versa. "
-                            + "uid: " + uid);
-                }
-                return INVALID_PROC_STATE_SEQ;
-            }
-            mLastHandledProcStateSeq.put(uid, procStateSeq);
-            mDispatchFlagsForCurProcStateSeq.put(uid, 0);
-            return procStateSeq;
-        }
-    }
-
-    /**
-     * Update dispatch flags to include {@param flag}.
-     */
-    private void setDispatchedFlagDL(int uid, long procStateSeq, int flag) {
-        int dispatchedFlag = mDispatchFlagsForCurProcStateSeq.get(uid);
-        dispatchedFlag |= flag;
-        mDispatchFlagsForCurProcStateSeq.put(uid, dispatchedFlag);
-    }
-
-    /**
-     * Check whether uid and firewall rules are dispatched to ConnectivityService and
-     * NetworkManagementService respectively, if so notify ActivityManagerService that network
-     * rules are updated.
-     */
-    private void checkAndNotifyDL(int uid, long procStateSeq) {
-        synchronized (mDispatchedThirdLock) {
-            final int dispatchedFlags = mDispatchFlagsForCurProcStateSeq.get(uid);
-            if (dispatchedFlags == FLAG_ALL_RULES_DISPATCHED) {
-                if (LOGD) {
-                    Slog.d(TAG, "Notifying AMS that network rules are updated for uid: " + uid
-                            + " seq: " + procStateSeq + " callers: " + Debug.getCallers(3));
-                }
-                mActivityManagerInternal.notifyNetworkPolicyRulesUpdated(uid, procStateSeq);
-            }
-        }
-    }
-
     private void removeUidStateUL(int uid) {
         final int index = mUidState.indexOfKey(uid);
         if (index >= 0) {
@@ -2621,21 +2494,17 @@
             mUidState.removeAt(index);
             if (oldUidState != ActivityManager.PROCESS_STATE_CACHED_EMPTY) {
                 updateRestrictBackgroundRulesOnUidStatusChangedUL(uid, oldUidState,
-                        ActivityManager.PROCESS_STATE_CACHED_EMPTY, true);
+                        ActivityManager.PROCESS_STATE_CACHED_EMPTY);
                 if (mDeviceIdleMode) {
                     updateRuleForDeviceIdleUL(uid);
                 }
                 if (mRestrictPower) {
                     updateRuleForRestrictPowerUL(uid);
                 }
-                updateRulesForPowerRestrictionsUL(uid, true);
+                updateRulesForPowerRestrictionsUL(uid);
                 updateNetworkStats(uid, false);
             }
         }
-        synchronized (mDispatchedThirdLock) {
-            mLastHandledProcStateSeq.delete(uid);
-            mDispatchFlagsForCurProcStateSeq.delete(uid);
-        }
     }
 
     // adjust stats accounting based on foreground status
@@ -2647,16 +2516,23 @@
         }
     }
 
-    private ReturnStatus updateRestrictBackgroundRulesOnUidStatusChangedUL(int uid, int oldUidState,
-            int newUidState, boolean notify) {
+    private void updateRestrictBackgroundRulesOnUidStatusChangedUL(int uid, int oldUidState,
+            int newUidState) {
         final boolean oldForeground =
-                isProcStateAllowedWhileRestrictBackgroundOn(oldUidState);
+                isProcStateAllowedWhileOnRestrictBackground(oldUidState);
         final boolean newForeground =
-                isProcStateAllowedWhileRestrictBackgroundOn(newUidState);
+                isProcStateAllowedWhileOnRestrictBackground(newUidState);
         if (oldForeground != newForeground) {
-            return updateRulesForDataUsageRestrictionsUL(uid, notify);
+            updateRulesForDataUsageRestrictionsUL(uid);
         }
-        return null;
+    }
+
+    static boolean isProcStateAllowedWhileIdleOrPowerSaveMode(int procState) {
+        return procState <= ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE;
+    }
+
+    static boolean isProcStateAllowedWhileOnRestrictBackground(int procState) {
+        return procState <= ActivityManager.PROCESS_STATE_FOREGROUND_SERVICE;
     }
 
     void updateRulesForPowerSaveUL() {
@@ -2805,7 +2681,7 @@
                 // Skip if it had no restrictions to begin with
                 if ((oldRules & MASK_ALL_NETWORKS) == 0) continue;
             }
-            updateRulesForPowerRestrictionsUL(uid, oldRules, paroled, true);
+            updateRulesForPowerRestrictionsUL(uid, oldRules, paroled);
         }
     }
 
@@ -2885,10 +2761,10 @@
                     final int uid = UserHandle.getUid(user.id, app.uid);
                     switch (type) {
                         case TYPE_RESTRICT_BACKGROUND:
-                            updateRulesForDataUsageRestrictionsUL(uid, true);
+                            updateRulesForDataUsageRestrictionsUL(uid);
                             break;
                         case TYPE_RESTRICT_POWER:
-                            updateRulesForPowerRestrictionsUL(uid, true);
+                            updateRulesForPowerRestrictionsUL(uid);
                             break;
                         default:
                             Slog.w(TAG, "Invalid type for updateRulesForAllApps: " + type);
@@ -2914,7 +2790,7 @@
                 updateRuleForDeviceIdleUL(uid);
                 updateRuleForRestrictPowerUL(uid);
                 // Update internal rules.
-                updateRulesForPowerRestrictionsUL(uid, true);
+                updateRulesForPowerRestrictionsUL(uid);
             }
         }
     }
@@ -2978,10 +2854,6 @@
         mPowerSaveWhitelistExceptIdleAppIds.delete(uid);
         mPowerSaveWhitelistAppIds.delete(uid);
         mPowerSaveTempWhitelistAppIds.delete(uid);
-        synchronized (mDispatchedThirdLock) {
-            mLastHandledProcStateSeq.delete(uid);
-            mDispatchFlagsForCurProcStateSeq.delete(uid);
-        }
 
         // ...then update iptables asynchronously.
         mHandler.obtainMessage(MSG_RESET_FIREWALL_RULES_BY_UID, uid, 0).sendToTarget();
@@ -3007,10 +2879,10 @@
         updateRuleForRestrictPowerUL(uid);
 
         // Update internal state for power-related modes.
-        updateRulesForPowerRestrictionsUL(uid, true);
+        updateRulesForPowerRestrictionsUL(uid);
 
         // Update firewall and internal rules for Data Saver Mode.
-        updateRulesForDataUsageRestrictionsUL(uid, true);
+        updateRulesForDataUsageRestrictionsUL(uid);
     }
 
     /**
@@ -3051,16 +2923,11 @@
      *
      * <p>The {@link #mUidRules} map is used to define the transtion of states of an UID.
      *
-     * @param uid The uid for which the rules have to be updated.
-     * @param notify Indicates whether to notify network policy listeners if the rules are updated.
-     *
-     * @return ReturnStatus includes new updated rules and whether network policy listeners
-     *         (INetworkPolicyListener) need to be notified.
      */
-    private ReturnStatus updateRulesForDataUsageRestrictionsUL(int uid, boolean notify) {
+    private void updateRulesForDataUsageRestrictionsUL(int uid) {
         if (!isUidValidForWhitelistRules(uid)) {
             if (LOGD) Slog.d(TAG, "no need to update restrict data rules for uid " + uid);
-            return new ReturnStatus(false, RULE_NONE);
+            return;
         }
 
         final int uidPolicy = mUidPolicy.get(uid, POLICY_NONE);
@@ -3155,12 +3022,9 @@
                         + ", oldRule=" + uidRulesToString(oldUidRules));
             }
 
-            if (notify) {
-                mHandler.obtainMessage(MSG_RULES_CHANGED, uid, newUidRules).sendToTarget();
-            }
-            return new ReturnStatus(true, newUidRules);
+            // Dispatch changed rule to existing listeners.
+            mHandler.obtainMessage(MSG_RULES_CHANGED, uid, newUidRules).sendToTarget();
         }
-        return new ReturnStatus(false, newUidRules);
     }
 
     /**
@@ -3181,18 +3045,16 @@
      * <p>
      * <strong>NOTE: </strong>This method does not update the firewall rules on {@code netd}.
      */
-    private ReturnStatus updateRulesForPowerRestrictionsUL(int uid, boolean notify) {
+    private void updateRulesForPowerRestrictionsUL(int uid) {
         final int oldUidRules = mUidRules.get(uid, RULE_NONE);
 
-        final ReturnStatus status = updateRulesForPowerRestrictionsUL(uid, oldUidRules, false,
-                notify);
+        final int newUidRules = updateRulesForPowerRestrictionsUL(uid, oldUidRules, false);
 
-        if (status.mNewUidRules == RULE_NONE) {
+        if (newUidRules == RULE_NONE) {
             mUidRules.delete(uid);
         } else {
-            mUidRules.put(uid, status.mNewUidRules);
+            mUidRules.put(uid, newUidRules);
         }
-        return status;
     }
 
     /**
@@ -3201,17 +3063,13 @@
      * @param uid the uid of the app to update rules for
      * @param oldUidRules the current rules for the uid, in order to determine if there's a change
      * @param paroled whether to ignore idle state of apps and only look at other restrictions.
-     * @param notify whether to notify network policy listeners (INetworkPolicyListener) if the
-     *               rules are updated.
      *
-     * @return ReturnStatus includes new updated rules and whether network policy listeners
-     *         (INetworkPolicyListener) need to be notified.
+     * @return the new computed rules for the uid
      */
-    private ReturnStatus updateRulesForPowerRestrictionsUL(int uid, int oldUidRules,
-            boolean paroled, boolean notify) {
+    private int updateRulesForPowerRestrictionsUL(int uid, int oldUidRules, boolean paroled) {
         if (!isUidValidForBlacklistRules(uid)) {
             if (LOGD) Slog.d(TAG, "no need to update restrict power rules for uid " + uid);
-            return new ReturnStatus(false, RULE_NONE);
+            return RULE_NONE;
         }
 
         final boolean isIdle = !paroled && isUidIdle(uid);
@@ -3263,23 +3121,10 @@
                         + ", newRule=" + uidRulesToString(newUidRules)
                         + ", oldRule=" + uidRulesToString(oldUidRules));
             }
-            if (notify) {
-                mHandler.obtainMessage(MSG_RULES_CHANGED, uid, newUidRules).sendToTarget();
-            }
-            return new ReturnStatus(true, newUidRules);
+            mHandler.obtainMessage(MSG_RULES_CHANGED, uid, newUidRules).sendToTarget();
         }
 
-        return new ReturnStatus(false, newUidRules);
-    }
-
-    private static final class ReturnStatus {
-        boolean mNeedToNotify;
-        int mNewUidRules;
-
-        ReturnStatus(boolean needToNotify, int newUidRules) {
-            mNeedToNotify = needToNotify;
-            mNewUidRules = newUidRules;
-        }
+        return newUidRules;
     }
 
     private class AppIdleStateChangeListener
@@ -3293,7 +3138,7 @@
                 if (LOGV) Log.v(TAG, "onAppIdleStateChanged(): uid=" + uid + ", idle=" + idle);
                 synchronized (mUidRulesFirstLock) {
                     updateRuleForAppIdleUL(uid);
-                    updateRulesForPowerRestrictionsUL(uid, true);
+                    updateRulesForPowerRestrictionsUL(uid);
                 }
             } catch (NameNotFoundException nnfe) {
             }
@@ -3353,26 +3198,13 @@
                 case MSG_RULES_CHANGED: {
                     final int uid = msg.arg1;
                     final int uidRules = msg.arg2;
-                    if (uidRules != RULE_INVALID) {
-                        dispatchUidRulesChanged(mConnectivityListener, uid, uidRules);
+                    dispatchUidRulesChanged(mConnectivityListener, uid, uidRules);
+                    final int length = mListeners.beginBroadcast();
+                    for (int i = 0; i < length; i++) {
+                        final INetworkPolicyListener listener = mListeners.getBroadcastItem(i);
+                        dispatchUidRulesChanged(listener, uid, uidRules);
                     }
-                    final Long procStateSeq = (Long) msg.obj;
-                    if (procStateSeq != null) {
-                        synchronized (mDispatchedThirdLock) {
-                            if (mLastHandledProcStateSeq.get(uid) == procStateSeq) {
-                                setDispatchedFlagDL(uid, procStateSeq, FLAG_UID_RULES_DISPATCHED);
-                                checkAndNotifyDL(uid, procStateSeq);
-                            }
-                        }
-                    }
-                    if (uidRules != RULE_INVALID) {
-                        final int length = mListeners.beginBroadcast();
-                        for (int i = 0; i < length; i++) {
-                            final INetworkPolicyListener listener = mListeners.getBroadcastItem(i);
-                            dispatchUidRulesChanged(listener, uid, uidRules);
-                        }
-                        mListeners.finishBroadcast();
-                    }
+                    mListeners.finishBroadcast();
                     return true;
                 }
                 case MSG_METERED_IFACES_CHANGED: {
diff --git a/services/core/jni/com_android_server_location_ContextHubService.cpp b/services/core/jni/com_android_server_location_ContextHubService.cpp
index 05ef0d1..27d2b6d 100644
--- a/services/core/jni/com_android_server_location_ContextHubService.cpp
+++ b/services/core/jni/com_android_server_location_ContextHubService.cpp
@@ -558,7 +558,7 @@
 void initContextHubService() {
     db.hubInfo.numHubs = 0;
 
-    db.hubInfo.contextHub = IContexthub::getService("context_hub");
+    db.hubInfo.contextHub = IContexthub::getService();
 
     if (db.hubInfo.contextHub == nullptr) {
         ALOGE("Could not load context hub hal");
diff --git a/services/tests/servicestests/src/com/android/server/usage/StorageStatsServiceTest.java b/services/tests/servicestests/src/com/android/server/usage/StorageStatsServiceTest.java
new file mode 100644
index 0000000..baee865
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/usage/StorageStatsServiceTest.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+package com.android.server.usage;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.provider.Settings;
+import android.test.AndroidTestCase;
+import android.test.mock.MockContentResolver;
+
+import com.android.internal.util.test.FakeSettingsProvider;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class StorageStatsServiceTest extends AndroidTestCase {
+    private MockContentResolver mContentResolver;
+
+    @Before
+    public void setUp() throws Exception {
+        super.setUp();
+        mContentResolver = new MockContentResolver();
+        mContentResolver.addProvider(Settings.AUTHORITY, new FakeSettingsProvider());
+    }
+
+    @Test
+    public void testDontRunWhenDisabledFromSettingsGlobal() throws Exception {
+        Settings.Global.putInt(mContentResolver, Settings.Global.ENABLE_CACHE_QUOTA_CALCULATION, 0);
+
+        assertThat(StorageStatsService.isCacheQuotaCalculationsEnabled(mContentResolver)).isFalse();
+    }
+
+    @Test
+    public void testCalculationTaskIsEnabledByDefault() throws Exception {
+        // Put null to act as though there is no value here.
+        Settings.Global.putString(
+                mContentResolver, Settings.Global.ENABLE_CACHE_QUOTA_CALCULATION, null);
+
+        assertThat(StorageStatsService.isCacheQuotaCalculationsEnabled(mContentResolver)).isTrue();
+    }
+}
diff --git a/services/usage/java/com/android/server/usage/StorageStatsService.java b/services/usage/java/com/android/server/usage/StorageStatsService.java
index a44860e..632c045 100644
--- a/services/usage/java/com/android/server/usage/StorageStatsService.java
+++ b/services/usage/java/com/android/server/usage/StorageStatsService.java
@@ -21,6 +21,7 @@
 import android.app.usage.IStorageStatsManager;
 import android.app.usage.StorageStats;
 import android.app.usage.UsageStatsManagerInternal;
+import android.content.ContentResolver;
 import android.content.Context;
 import android.content.pm.ApplicationInfo;
 import android.content.pm.PackageManager;
@@ -39,9 +40,11 @@
 import android.os.storage.StorageEventListener;
 import android.os.storage.StorageManager;
 import android.os.storage.VolumeInfo;
+import android.provider.Settings;
 import android.text.format.DateUtils;
 import android.util.Slog;
 
+import com.android.internal.annotations.VisibleForTesting;
 import com.android.internal.util.ArrayUtils;
 import com.android.internal.util.Preconditions;
 import com.android.server.IoThread;
@@ -328,6 +331,11 @@
             if (DEBUG) {
                 Slog.v(TAG, ">>> handling " + msg.what);
             }
+
+            if (!isCacheQuotaCalculationsEnabled(mContext.getContentResolver())) {
+                return;
+            }
+
             switch (msg.what) {
                 case MSG_CHECK_STORAGE_DELTA: {
                     long bytesDelta = Math.abs(mPreviousBytes - mStats.getFreeBytes());
@@ -359,4 +367,10 @@
             strategy.recalculateQuotas();
         }
     }
+
+    @VisibleForTesting
+    static boolean isCacheQuotaCalculationsEnabled(ContentResolver resolver) {
+        return Settings.Global.getInt(
+                resolver, Settings.Global.ENABLE_CACHE_QUOTA_CALCULATION, 1) != 0;
+    }
 }
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index 7c9c0e8..a4235d7 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -6144,7 +6144,7 @@
      * android.content.pm.PackageManager#FEATURE_TELEPHONY_CARRIERLOCK} enabled.
      *
      * @return The number of carriers set successfully. Should be length of
-     * carrierList on success; -1 on error.
+     * carrierList on success; -1 if carrierList null or on error.
      * @hide
      */
     @SystemApi
