Merge changes from topic "statsd_socket_review" into pi-dev

* changes:
  Add socket listener to statsd. And remove Davey atom.
  Allow StatsLog to directly write to statsd's socket.
diff --git a/cmds/sm/src/com/android/commands/sm/Sm.java b/cmds/sm/src/com/android/commands/sm/Sm.java
index 2bb7edc..09343f1 100644
--- a/cmds/sm/src/com/android/commands/sm/Sm.java
+++ b/cmds/sm/src/com/android/commands/sm/Sm.java
@@ -147,9 +147,21 @@
     }
 
     public void runSetForceAdoptable() throws RemoteException {
-        final boolean forceAdoptable = Boolean.parseBoolean(nextArg());
-        mSm.setDebugFlags(forceAdoptable ? StorageManager.DEBUG_FORCE_ADOPTABLE : 0,
-                StorageManager.DEBUG_FORCE_ADOPTABLE);
+        final int mask = StorageManager.DEBUG_ADOPTABLE_FORCE_ON
+                | StorageManager.DEBUG_ADOPTABLE_FORCE_OFF;
+        switch (nextArg()) {
+            case "on":
+            case "true":
+                mSm.setDebugFlags(StorageManager.DEBUG_ADOPTABLE_FORCE_ON, mask);
+                break;
+            case "off":
+                mSm.setDebugFlags(StorageManager.DEBUG_ADOPTABLE_FORCE_OFF, mask);
+                break;
+            case "default":
+            case "false":
+                mSm.setDebugFlags(0, mask);
+                break;
+        }
     }
 
     public void runSetSdcardfs() throws RemoteException {
@@ -289,7 +301,7 @@
         System.err.println("       sm list-volumes [public|private|emulated|all]");
         System.err.println("       sm has-adoptable");
         System.err.println("       sm get-primary-storage-uuid");
-        System.err.println("       sm set-force-adoptable [true|false]");
+        System.err.println("       sm set-force-adoptable [on|off|default]");
         System.err.println("       sm set-virtual-disk [true|false]");
         System.err.println("");
         System.err.println("       sm partition DISK [public|private|mixed] [ratio]");
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index 20149de..b456b72 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -759,6 +759,7 @@
     private static final int LOG_AM_ON_STOP_CALLED = 30049;
     private static final int LOG_AM_ON_RESTART_CALLED = 30058;
     private static final int LOG_AM_ON_DESTROY_CALLED = 30060;
+    private static final int LOG_AM_ON_ACTIVITY_RESULT_CALLED = 30062;
 
     private static class ManagedDialog {
         Dialog mDialog;
@@ -7438,8 +7439,8 @@
         }
     }
 
-    void dispatchActivityResult(String who, int requestCode,
-        int resultCode, Intent data) {
+    void dispatchActivityResult(String who, int requestCode, int resultCode, Intent data,
+            String reason) {
         if (false) Log.v(
             TAG, "Dispatching result: who=" + who + ", reqCode=" + requestCode
             + ", resCode=" + resultCode + ", data=" + data);
@@ -7475,6 +7476,7 @@
                 frag.onActivityResult(requestCode, resultCode, data);
             }
         }
+        writeEventLog(LOG_AM_ON_ACTIVITY_RESULT_CALLED, reason);
     }
 
     /**
diff --git a/core/java/android/app/ActivityGroup.java b/core/java/android/app/ActivityGroup.java
index 78a4dfd..228067c 100644
--- a/core/java/android/app/ActivityGroup.java
+++ b/core/java/android/app/ActivityGroup.java
@@ -16,11 +16,11 @@
 
 package android.app;
 
-import java.util.HashMap;
-
 import android.content.Intent;
 import android.os.Bundle;
 
+import java.util.HashMap;
+
 /**
  * A screen that contains and runs multiple embedded activities.
  *
@@ -109,7 +109,7 @@
 
     @Override
     void dispatchActivityResult(String who, int requestCode, int resultCode,
-            Intent data) {
+            Intent data, String reason) {
         if (who != null) {
             Activity act = mLocalActivityManager.getActivity(who);
             /*
@@ -123,7 +123,7 @@
                 return;
             }
         }
-        super.dispatchActivityResult(who, requestCode, resultCode, data);
+        super.dispatchActivityResult(who, requestCode, resultCode, data, reason);
     }
 }
 
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index a41da0e..037a87b 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -3730,7 +3730,7 @@
                 r.pendingIntents = null;
             }
             if (r.pendingResults != null) {
-                deliverResults(r, r.pendingResults);
+                deliverResults(r, r.pendingResults, reason);
                 r.pendingResults = null;
             }
             r.activity.performResume(r.startsNotResumed, reason);
@@ -4299,7 +4299,7 @@
         WindowManagerGlobal.getInstance().reportNewConfiguration(mConfiguration);
     }
 
-    private void deliverResults(ActivityClientRecord r, List<ResultInfo> results) {
+    private void deliverResults(ActivityClientRecord r, List<ResultInfo> results, String reason) {
         final int N = results.size();
         for (int i=0; i<N; i++) {
             ResultInfo ri = results.get(i);
@@ -4311,7 +4311,7 @@
                 if (DEBUG_RESULTS) Slog.v(TAG,
                         "Delivering result to activity " + r + " : " + ri);
                 r.activity.dispatchActivityResult(ri.mResultWho,
-                        ri.mRequestCode, ri.mResultCode, ri.mData);
+                        ri.mRequestCode, ri.mResultCode, ri.mData, reason);
             } catch (Exception e) {
                 if (!mInstrumentation.onException(r.activity, e)) {
                     throw new RuntimeException(
@@ -4324,7 +4324,7 @@
     }
 
     @Override
-    public void handleSendResult(IBinder token, List<ResultInfo> results) {
+    public void handleSendResult(IBinder token, List<ResultInfo> results, String reason) {
         ActivityClientRecord r = mActivities.get(token);
         if (DEBUG_RESULTS) Slog.v(TAG, "Handling send result to " + r);
         if (r != null) {
@@ -4359,9 +4359,9 @@
                 }
             }
             checkAndBlockForNetworkAccess();
-            deliverResults(r, results);
+            deliverResults(r, results, reason);
             if (resumed) {
-                r.activity.performResume(false, "handleSendResult");
+                r.activity.performResume(false, reason);
                 r.activity.mTemporaryPause = false;
             }
         }
diff --git a/core/java/android/app/ClientTransactionHandler.java b/core/java/android/app/ClientTransactionHandler.java
index e26d989..ea0d703 100644
--- a/core/java/android/app/ClientTransactionHandler.java
+++ b/core/java/android/app/ClientTransactionHandler.java
@@ -121,7 +121,7 @@
             Configuration overrideConfig, int displayId);
 
     /** Deliver result from another activity. */
-    public abstract void handleSendResult(IBinder token, List<ResultInfo> results);
+    public abstract void handleSendResult(IBinder token, List<ResultInfo> results, String reason);
 
     /** Deliver multi-window mode change notification. */
     public abstract void handleMultiWindowModeChanged(IBinder token, boolean isInMultiWindowMode,
diff --git a/core/java/android/app/servertransaction/ActivityResultItem.java b/core/java/android/app/servertransaction/ActivityResultItem.java
index 545463c..e57f585 100644
--- a/core/java/android/app/servertransaction/ActivityResultItem.java
+++ b/core/java/android/app/servertransaction/ActivityResultItem.java
@@ -16,7 +16,6 @@
 
 package android.app.servertransaction;
 
-import static android.app.servertransaction.ActivityLifecycleItem.ON_RESUME;
 import static android.os.Trace.TRACE_TAG_ACTIVITY_MANAGER;
 
 import android.app.ClientTransactionHandler;
@@ -37,16 +36,17 @@
 
     private List<ResultInfo> mResultInfoList;
 
+    /* TODO(b/78294732)
     @Override
     public int getPostExecutionState() {
         return ON_RESUME;
-    }
+    }*/
 
     @Override
     public void execute(ClientTransactionHandler client, IBinder token,
             PendingTransactionActions pendingActions) {
         Trace.traceBegin(TRACE_TAG_ACTIVITY_MANAGER, "activityDeliverResult");
-        client.handleSendResult(token, mResultInfoList);
+        client.handleSendResult(token, mResultInfoList, "ACTIVITY_RESULT");
         Trace.traceEnd(TRACE_TAG_ACTIVITY_MANAGER);
     }
 
diff --git a/core/java/android/os/storage/StorageManager.java b/core/java/android/os/storage/StorageManager.java
index 8905ad1..2d1bb2f 100644
--- a/core/java/android/os/storage/StorageManager.java
+++ b/core/java/android/os/storage/StorageManager.java
@@ -115,7 +115,7 @@
     /** {@hide} */
     public static final String PROP_HAS_RESERVED = "vold.has_reserved";
     /** {@hide} */
-    public static final String PROP_FORCE_ADOPTABLE = "persist.fw.force_adoptable";
+    public static final String PROP_ADOPTABLE = "persist.sys.adoptable";
     /** {@hide} */
     public static final String PROP_EMULATE_FBE = "persist.sys.emulate_fbe";
     /** {@hide} */
@@ -197,15 +197,17 @@
     public static final String EXTRA_REQUESTED_BYTES = "android.os.storage.extra.REQUESTED_BYTES";
 
     /** {@hide} */
-    public static final int DEBUG_FORCE_ADOPTABLE = 1 << 0;
+    public static final int DEBUG_ADOPTABLE_FORCE_ON = 1 << 0;
     /** {@hide} */
-    public static final int DEBUG_EMULATE_FBE = 1 << 1;
+    public static final int DEBUG_ADOPTABLE_FORCE_OFF = 1 << 1;
     /** {@hide} */
-    public static final int DEBUG_SDCARDFS_FORCE_ON = 1 << 2;
+    public static final int DEBUG_EMULATE_FBE = 1 << 2;
     /** {@hide} */
-    public static final int DEBUG_SDCARDFS_FORCE_OFF = 1 << 3;
+    public static final int DEBUG_SDCARDFS_FORCE_ON = 1 << 3;
     /** {@hide} */
-    public static final int DEBUG_VIRTUAL_DISK = 1 << 4;
+    public static final int DEBUG_SDCARDFS_FORCE_OFF = 1 << 4;
+    /** {@hide} */
+    public static final int DEBUG_VIRTUAL_DISK = 1 << 5;
 
     // NOTE: keep in sync with installd
     /** {@hide} */
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 0de2cb0..590f988 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -1623,6 +1623,8 @@
   <java-symbol type="anim" name="task_open_enter_cross_profile_apps" />
   <java-symbol type="anim" name="activity_translucent_open_enter" />
   <java-symbol type="anim" name="activity_translucent_close_exit" />
+  <java-symbol type="anim" name="activity_open_enter" />
+  <java-symbol type="anim" name="activity_close_exit" />
 
   <java-symbol type="array" name="config_autoRotationTiltTolerance" />
   <java-symbol type="array" name="config_keyboardTapVibePattern" />
diff --git a/core/tests/coretests/src/android/app/servertransaction/TransactionExecutorTests.java b/core/tests/coretests/src/android/app/servertransaction/TransactionExecutorTests.java
index 3eefc36..fe58116 100644
--- a/core/tests/coretests/src/android/app/servertransaction/TransactionExecutorTests.java
+++ b/core/tests/coretests/src/android/app/servertransaction/TransactionExecutorTests.java
@@ -40,7 +40,10 @@
 
 import android.app.ActivityThread.ActivityClientRecord;
 import android.app.ClientTransactionHandler;
+import android.app.servertransaction.ActivityLifecycleItem.LifecycleState;
 import android.os.IBinder;
+import android.os.Parcel;
+import android.os.Parcelable;
 import android.platform.test.annotations.Presubmit;
 import android.support.test.filters.SmallTest;
 import android.support.test.runner.AndroidJUnit4;
@@ -50,7 +53,6 @@
 import org.junit.runner.RunWith;
 import org.mockito.InOrder;
 
-import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
@@ -231,12 +233,12 @@
 
     @Test
     public void testActivityResultRequiredStateResolution() {
-        ActivityResultItem activityResultItem = ActivityResultItem.obtain(new ArrayList<>());
+        PostExecItem postExecItem = new PostExecItem(ON_RESUME);
 
         IBinder token = mock(IBinder.class);
         ClientTransaction transaction = ClientTransaction.obtain(null /* client */,
                 token /* activityToken */);
-        transaction.addCallback(activityResultItem);
+        transaction.addCallback(postExecItem);
 
         // Verify resolution that should get to onPause
         mClientRecord.setState(ON_RESUME);
@@ -395,4 +397,54 @@
         return mExecutorHelper.getLifecyclePath(mClientRecord.getLifecycleState(), finish,
                 true /* excludeLastState */).toArray();
     }
+
+    /** A transaction item that requires some specific post-execution state. */
+    private static class PostExecItem extends StubItem {
+
+        @LifecycleState
+        private int mPostExecutionState;
+
+        PostExecItem(@LifecycleState int state) {
+            mPostExecutionState = state;
+        }
+
+        @Override
+        public int getPostExecutionState() {
+            return mPostExecutionState;
+        }
+    }
+
+    /** Stub implementation of a transaction item that works as a base class for items in tests. */
+    private static class StubItem extends ClientTransactionItem  {
+
+        private StubItem() {
+        }
+
+        private StubItem(Parcel in) {
+        }
+
+        @Override
+        public void execute(ClientTransactionHandler client, IBinder token,
+                PendingTransactionActions pendingActions) {
+        }
+
+        @Override
+        public void recycle() {
+        }
+
+        @Override
+        public void writeToParcel(Parcel dest, int flags) {
+        }
+
+        public static final Parcelable.Creator<StubItem> CREATOR =
+                new Parcelable.Creator<StubItem>() {
+                    public StubItem createFromParcel(Parcel in) {
+                        return new StubItem(in);
+                    }
+
+                    public StubItem[] newArray(int size) {
+                        return new StubItem[size];
+                    }
+                };
+    }
 }
diff --git a/packages/SettingsLib/res/values/strings.xml b/packages/SettingsLib/res/values/strings.xml
index 6368607..50c9b5c 100644
--- a/packages/SettingsLib/res/values/strings.xml
+++ b/packages/SettingsLib/res/values/strings.xml
@@ -902,16 +902,18 @@
     <!-- Summary shown for color space correction preference when its value is overridden by another preference [CHAR LIMIT=35] -->
     <string name="daltonizer_type_overridden">Overridden by <xliff:g id="title" example="Simulate color space">%1$s</xliff:g></string>
 
+    <!-- [CHAR_LIMIT=NONE] Label for battery on main page of settings -->
+    <string name="power_remaining_settings_home_page"><xliff:g id="percentage" example="10%">%1$s</xliff:g> - <xliff:g id="time_string" example="1 hour left based on your usage">%2$s</xliff:g></string>
     <!-- [CHAR_LIMIT=40] Label for estimated remaining duration of battery discharging -->
-    <string name="power_remaining_duration_only">About <xliff:g id="time">%1$s</xliff:g> left</string>
+    <string name="power_remaining_duration_only">About <xliff:g id="time_remaining">%1$s</xliff:g> left</string>
     <!-- [CHAR_LIMIT=40] Label for battery level chart when discharging with duration -->
-    <string name="power_discharging_duration">About <xliff:g id="time">%1$s</xliff:g> left (<xliff:g id="level">%2$s</xliff:g>)</string>
+    <string name="power_discharging_duration">About <xliff:g id="time_remaining">%1$s</xliff:g> left (<xliff:g id="level">%2$s</xliff:g>)</string>
     <!-- [CHAR_LIMIT=60] Label for estimated remaining duration of battery discharging -->
-    <string name="power_remaining_duration_only_enhanced">About <xliff:g id="time">%1$s</xliff:g> left based on your usage</string>
+    <string name="power_remaining_duration_only_enhanced">About <xliff:g id="time_remaining">%1$s</xliff:g> left based on your usage</string>
     <!-- [CHAR_LIMIT=60] Label for battery level chart when discharging with duration and using enhanced estimate -->
-    <string name="power_discharging_duration_enhanced">About <xliff:g id="time">%1$s</xliff:g> left based on your usage (<xliff:g id="level">%2$s</xliff:g>)</string>
+    <string name="power_discharging_duration_enhanced">About <xliff:g id="time_remaining">%1$s</xliff:g> left based on your usage (<xliff:g id="level">%2$s</xliff:g>)</string>
     <!-- [CHAR_LIMIT=40] Short label for estimated remaining duration of battery charging/discharging -->
-    <string name="power_remaining_duration_only_short"><xliff:g id="time">%1$s</xliff:g> left</string>
+    <string name="power_remaining_duration_only_short"><xliff:g id="time_remaining">%1$s</xliff:g> left</string>
 
     <!-- [CHAR_LIMIT=100] Label for enhanced estimated time that phone will run out of battery -->
     <string name="power_discharge_by_enhanced">Should last until about <xliff:g id="time">%1$s</xliff:g> based on your usage (<xliff:g id="level">%2$s</xliff:g>)</string>
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl
index d22aab5..3ecf89c 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl
@@ -49,4 +49,9 @@
      * Notifies SystemUI that Overview is shown.
      */
     void onOverviewShown(boolean fromHome) = 6;
+
+    /**
+     * Get the secondary split screen app's rectangle when not minimized.
+     */
+    Rect getNonMinimizedSplitScreenSecondaryBounds() = 7;
 }
diff --git a/packages/SystemUI/src/com/android/systemui/OverviewProxyService.java b/packages/SystemUI/src/com/android/systemui/OverviewProxyService.java
index e1540ea..282a8f1 100644
--- a/packages/SystemUI/src/com/android/systemui/OverviewProxyService.java
+++ b/packages/SystemUI/src/com/android/systemui/OverviewProxyService.java
@@ -22,7 +22,6 @@
 import android.content.Intent;
 import android.content.IntentFilter;
 import android.content.ServiceConnection;
-import android.content.pm.PackageManager;
 import android.graphics.Rect;
 import android.os.Binder;
 import android.os.Handler;
@@ -42,6 +41,7 @@
 import com.android.systemui.shared.recents.ISystemUiProxy;
 import com.android.systemui.shared.system.ActivityManagerWrapper;
 import com.android.systemui.shared.system.GraphicBufferCompat;
+import com.android.systemui.stackdivider.Divider;
 import com.android.systemui.statusbar.phone.StatusBar;
 import com.android.systemui.statusbar.policy.CallbackController;
 import com.android.systemui.statusbar.policy.DeviceProvisionedController;
@@ -147,6 +147,19 @@
                 Binder.restoreCallingIdentity(token);
             }
         }
+
+        public Rect getNonMinimizedSplitScreenSecondaryBounds() {
+            long token = Binder.clearCallingIdentity();
+            try {
+                Divider divider = ((SystemUIApplication) mContext).getComponent(Divider.class);
+                if (divider != null) {
+                    return divider.getView().getNonMinimizedSplitScreenSecondaryBounds();
+                }
+                return null;
+            } finally {
+                Binder.restoreCallingIdentity(token);
+            }
+        }
     };
 
     private final BroadcastReceiver mLauncherStateChangedReceiver = new BroadcastReceiver() {
diff --git a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java
index 3d8e037..1149ad1 100644
--- a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java
+++ b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java
@@ -378,6 +378,23 @@
         return mWindowManagerProxy;
     }
 
+    public Rect getNonMinimizedSplitScreenSecondaryBounds() {
+        calculateBoundsForPosition(mSnapTargetBeforeMinimized.position,
+                DockedDividerUtils.invertDockSide(mDockSide), mOtherTaskRect);
+        switch (mDockSide) {
+            case WindowManager.DOCKED_LEFT:
+                mOtherTaskRect.right -= mStableInsets.right;
+                break;
+            case WindowManager.DOCKED_RIGHT:
+                mOtherTaskRect.left -= mStableInsets.left;
+                break;
+            case WindowManager.DOCKED_TOP:
+                mOtherTaskRect.bottom -= mStableInsets.bottom;
+                break;
+        }
+        return mOtherTaskRect;
+    }
+
     public boolean startDragging(boolean animate, boolean touching) {
         cancelFlingAnimation();
         if (touching) {
diff --git a/services/core/java/com/android/server/StorageManagerService.java b/services/core/java/com/android/server/StorageManagerService.java
index 99e0459..6c35bda 100644
--- a/services/core/java/com/android/server/StorageManagerService.java
+++ b/services/core/java/com/android/server/StorageManagerService.java
@@ -25,11 +25,9 @@
 import static android.os.storage.OnObbStateChangeListener.MOUNTED;
 import static android.os.storage.OnObbStateChangeListener.UNMOUNTED;
 
-import static com.android.internal.util.XmlUtils.readBooleanAttribute;
 import static com.android.internal.util.XmlUtils.readIntAttribute;
 import static com.android.internal.util.XmlUtils.readLongAttribute;
 import static com.android.internal.util.XmlUtils.readStringAttribute;
-import static com.android.internal.util.XmlUtils.writeBooleanAttribute;
 import static com.android.internal.util.XmlUtils.writeIntAttribute;
 import static com.android.internal.util.XmlUtils.writeLongAttribute;
 import static com.android.internal.util.XmlUtils.writeStringAttribute;
@@ -249,7 +247,6 @@
     private static final String TAG_VOLUMES = "volumes";
     private static final String ATTR_VERSION = "version";
     private static final String ATTR_PRIMARY_STORAGE_UUID = "primaryStorageUuid";
-    private static final String ATTR_FORCE_ADOPTABLE = "forceAdoptable";
     private static final String TAG_VOLUME = "volume";
     private static final String ATTR_TYPE = "type";
     private static final String ATTR_FS_UUID = "fsUuid";
@@ -287,8 +284,6 @@
     private ArrayMap<String, VolumeRecord> mRecords = new ArrayMap<>();
     @GuardedBy("mLock")
     private String mPrimaryStorageUuid;
-    @GuardedBy("mLock")
-    private boolean mForceAdoptable;
 
     /** Map from disk ID to latches */
     @GuardedBy("mLock")
@@ -1011,9 +1006,14 @@
         @Override
         public void onDiskCreated(String diskId, int flags) {
             synchronized (mLock) {
-                if (SystemProperties.getBoolean(StorageManager.PROP_FORCE_ADOPTABLE, false)
-                        || mForceAdoptable) {
-                    flags |= DiskInfo.FLAG_ADOPTABLE;
+                final String value = SystemProperties.get(StorageManager.PROP_ADOPTABLE);
+                switch (value) {
+                    case "force_on":
+                        flags |= DiskInfo.FLAG_ADOPTABLE;
+                        break;
+                    case "force_off":
+                        flags &= ~DiskInfo.FLAG_ADOPTABLE;
+                        break;
                 }
                 mDisks.put(diskId, new DiskInfo(diskId, flags));
             }
@@ -1530,7 +1530,6 @@
     private void readSettingsLocked() {
         mRecords.clear();
         mPrimaryStorageUuid = getDefaultPrimaryStorageUuid();
-        mForceAdoptable = false;
 
         FileInputStream fis = null;
         try {
@@ -1552,7 +1551,6 @@
                             mPrimaryStorageUuid = readStringAttribute(in,
                                     ATTR_PRIMARY_STORAGE_UUID);
                         }
-                        mForceAdoptable = readBooleanAttribute(in, ATTR_FORCE_ADOPTABLE, false);
 
                     } else if (TAG_VOLUME.equals(tag)) {
                         final VolumeRecord rec = readVolumeRecord(in);
@@ -1583,7 +1581,6 @@
             out.startTag(null, TAG_VOLUMES);
             writeIntAttribute(out, ATTR_VERSION, VERSION_FIX_PRIMARY);
             writeStringAttribute(out, ATTR_PRIMARY_STORAGE_UUID, mPrimaryStorageUuid);
-            writeBooleanAttribute(out, ATTR_FORCE_ADOPTABLE, mForceAdoptable);
             final int size = mRecords.size();
             for (int i = 0; i < size; i++) {
                 final VolumeRecord rec = mRecords.valueAt(i);
@@ -1980,12 +1977,25 @@
             }
         }
 
-        if ((mask & StorageManager.DEBUG_FORCE_ADOPTABLE) != 0) {
-            synchronized (mLock) {
-                mForceAdoptable = (flags & StorageManager.DEBUG_FORCE_ADOPTABLE) != 0;
+        if ((mask & (StorageManager.DEBUG_ADOPTABLE_FORCE_ON
+                | StorageManager.DEBUG_ADOPTABLE_FORCE_OFF)) != 0) {
+            final String value;
+            if ((flags & StorageManager.DEBUG_ADOPTABLE_FORCE_ON) != 0) {
+                value = "force_on";
+            } else if ((flags & StorageManager.DEBUG_ADOPTABLE_FORCE_OFF) != 0) {
+                value = "force_off";
+            } else {
+                value = "";
+            }
 
-                writeSettingsLocked();
+            final long token = Binder.clearCallingIdentity();
+            try {
+                SystemProperties.set(StorageManager.PROP_ADOPTABLE, value);
+
+                // Reset storage to kick new setting into place
                 mHandler.obtainMessage(H_RESET).sendToTarget();
+            } finally {
+                Binder.restoreCallingIdentity(token);
             }
         }
 
@@ -3564,8 +3574,6 @@
                 pw.print(DataUnit.MEBIBYTES.toBytes(pair.second));
                 pw.println(" MiB)");
             }
-            pw.println("Force adoptable: " + mForceAdoptable);
-            pw.println();
             pw.println("Local unlocked users: " + Arrays.toString(mLocalUnlockedUsers));
             pw.println("System unlocked users: " + Arrays.toString(mSystemUnlockedUsers));
         }
diff --git a/services/core/java/com/android/server/am/EventLogTags.logtags b/services/core/java/com/android/server/am/EventLogTags.logtags
index 40b9e4f..ed891df 100644
--- a/services/core/java/com/android/server/am/EventLogTags.logtags
+++ b/services/core/java/com/android/server/am/EventLogTags.logtags
@@ -134,6 +134,8 @@
 30059 am_on_start_called (User|1|5),(Component Name|3),(Reason|3)
 # The activity's onDestroy has been called.
 30060 am_on_destroy_called (User|1|5),(Component Name|3),(Reason|3)
+# The activity's onActivityResult has been called.
+30062 am_on_activity_result_called (User|1|5),(Component Name|3),(Reason|3)
 
 # The task is being removed from its parent stack
 30061 am_remove_task (Task ID|1|5), (Stack ID|1|5)
\ No newline at end of file
diff --git a/services/core/java/com/android/server/wm/AppTransition.java b/services/core/java/com/android/server/wm/AppTransition.java
index a24ac21..0dc06b2 100644
--- a/services/core/java/com/android/server/wm/AppTransition.java
+++ b/services/core/java/com/android/server/wm/AppTransition.java
@@ -554,7 +554,7 @@
         return null;
     }
 
-    Animation loadAnimationAttr(LayoutParams lp, int animAttr) {
+    Animation loadAnimationAttr(LayoutParams lp, int animAttr, int transit) {
         int anim = 0;
         Context context = mContext;
         if (animAttr >= 0) {
@@ -564,6 +564,7 @@
                 anim = ent.array.getResourceId(animAttr, 0);
             }
         }
+        anim = updateToTranslucentAnimIfNeeded(anim, transit);
         if (anim != 0) {
             return AnimationUtils.loadAnimation(context, anim);
         }
@@ -598,6 +599,16 @@
         return null;
     }
 
+    private int updateToTranslucentAnimIfNeeded(int anim, int transit) {
+        if (transit == TRANSIT_TRANSLUCENT_ACTIVITY_OPEN && anim == R.anim.activity_open_enter) {
+            return R.anim.activity_translucent_open_enter;
+        }
+        if (transit == TRANSIT_TRANSLUCENT_ACTIVITY_CLOSE && anim == R.anim.activity_close_exit) {
+            return R.anim.activity_translucent_close_exit;
+        }
+        return anim;
+    }
+
     /**
      * Compute the pivot point for an animation that is scaling from a small
      * rect on screen to a larger rect.  The pivot point varies depending on
@@ -1664,29 +1675,17 @@
                     "applyAnimation NEXT_TRANSIT_TYPE_OPEN_CROSS_PROFILE_APPS:"
                             + " anim=" + a + " transit=" + appTransitionToString(transit)
                             + " isEntrance=true" + " Callers=" + Debug.getCallers(3));
-        } else if (transit == TRANSIT_TRANSLUCENT_ACTIVITY_OPEN && enter) {
-            a = loadAnimationRes("android",
-                    com.android.internal.R.anim.activity_translucent_open_enter);
-            Slog.v(TAG,
-                    "applyAnimation TRANSIT_TRANSLUCENT_ACTIVITY_OPEN:"
-                            + " anim=" + a + " transit=" + appTransitionToString(transit)
-                            + " isEntrance=true" + " Callers=" + Debug.getCallers(3));
-        } else if (transit == TRANSIT_TRANSLUCENT_ACTIVITY_CLOSE && !enter) {
-            a = loadAnimationRes("android",
-                    com.android.internal.R.anim.activity_translucent_close_exit);
-            Slog.v(TAG,
-                    "applyAnimation TRANSIT_TRANSLUCENT_ACTIVITY_CLOSE:"
-                            + " anim=" + a + " transit=" + appTransitionToString(transit)
-                            + " isEntrance=false" + " Callers=" + Debug.getCallers(3));
         } else {
             int animAttr = 0;
             switch (transit) {
                 case TRANSIT_ACTIVITY_OPEN:
+                case TRANSIT_TRANSLUCENT_ACTIVITY_OPEN:
                     animAttr = enter
                             ? WindowAnimation_activityOpenEnterAnimation
                             : WindowAnimation_activityOpenExitAnimation;
                     break;
                 case TRANSIT_ACTIVITY_CLOSE:
+                case TRANSIT_TRANSLUCENT_ACTIVITY_CLOSE:
                     animAttr = enter
                             ? WindowAnimation_activityCloseEnterAnimation
                             : WindowAnimation_activityCloseExitAnimation;
@@ -1737,7 +1736,7 @@
                             ? WindowAnimation_launchTaskBehindSourceAnimation
                             : WindowAnimation_launchTaskBehindTargetAnimation;
             }
-            a = animAttr != 0 ? loadAnimationAttr(lp, animAttr) : null;
+            a = animAttr != 0 ? loadAnimationAttr(lp, animAttr, transit) : null;
             if (DEBUG_APP_TRANSITIONS || DEBUG_ANIM) Slog.v(TAG,
                     "applyAnimation:"
                     + " anim=" + a
diff --git a/services/core/java/com/android/server/wm/WindowStateAnimator.java b/services/core/java/com/android/server/wm/WindowStateAnimator.java
index 195274a..a3428f0 100644
--- a/services/core/java/com/android/server/wm/WindowStateAnimator.java
+++ b/services/core/java/com/android/server/wm/WindowStateAnimator.java
@@ -23,6 +23,7 @@
 import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING;
 import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD;
 import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER;
+import static android.view.WindowManager.TRANSIT_NONE;
 import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_ANIM;
 import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
 import static com.android.server.wm.DragResizeMode.DRAG_RESIZE_MODE_FREEFORM;
@@ -1360,7 +1361,7 @@
                         break;
                 }
                 if (attr >= 0) {
-                    a = mService.mAppTransition.loadAnimationAttr(mWin.mAttrs, attr);
+                    a = mService.mAppTransition.loadAnimationAttr(mWin.mAttrs, attr, TRANSIT_NONE);
                 }
             }
             if (DEBUG_ANIM) Slog.v(TAG,
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index ba39ffd..19061f9 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -1841,24 +1841,23 @@
     }
 
     /**
-     * Returns the ISO country code equivalent of the current registered
-     * operator's MCC (Mobile Country Code).
+     * Returns the ISO country code equivalent of the MCC (Mobile Country Code) of the current
+     * registered operator, or nearby cell information if not registered.
+     * .
      * <p>
-     * Availability: Only when user is registered to a network. Result may be
-     * unreliable on CDMA networks (use {@link #getPhoneType()} to determine if
-     * on a CDMA network).
+     * Note: Result may be unreliable on CDMA networks (use {@link #getPhoneType()} to determine
+     * if on a CDMA network).
      */
     public String getNetworkCountryIso() {
         return getNetworkCountryIsoForPhone(getPhoneId());
     }
 
     /**
-     * Returns the ISO country code equivalent of the current registered
-     * operator's MCC (Mobile Country Code) of a subscription.
+     * Returns the ISO country code equivalent of the MCC (Mobile Country Code) of the current
+     * registered operator, or nearby cell information if not registered.
      * <p>
-     * Availability: Only when user is registered to a network. Result may be
-     * unreliable on CDMA networks (use {@link #getPhoneType()} to determine if
-     * on a CDMA network).
+     * Note: Result may be unreliable on CDMA networks (use {@link #getPhoneType()} to determine
+     * if on a CDMA network).
      *
      * @param subId for which Network CountryIso is returned
      * @hide