Merge changes from topics "cherrypick-device_id_activity-jjzdpul0z9", "cherrypick-recreate-activity" into udc-dev am: a717b6e467
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21468067 Change-Id: Ia549c5573cafaa0b9b00745399dc5c765d84e6a1 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -558,9 +558,6 @@ public final class ActivityThread extends ClientTransactionHandler
|
|||||||
boolean hideForNow;
|
boolean hideForNow;
|
||||||
Configuration createdConfig;
|
Configuration createdConfig;
|
||||||
Configuration overrideConfig;
|
Configuration overrideConfig;
|
||||||
// TODO(b/263402465): pass deviceId directly in LaunchActivityItem#execute
|
|
||||||
// The deviceId assigned by the server when this activity was first started.
|
|
||||||
int mDeviceId;
|
|
||||||
// Used for consolidating configs before sending on to Activity.
|
// Used for consolidating configs before sending on to Activity.
|
||||||
private Configuration tmpConfig = new Configuration();
|
private Configuration tmpConfig = new Configuration();
|
||||||
// Callback used for updating activity override config and camera compat control state.
|
// Callback used for updating activity override config and camera compat control state.
|
||||||
@@ -623,7 +620,7 @@ public final class ActivityThread extends ClientTransactionHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ActivityClientRecord(IBinder token, Intent intent, int ident,
|
public ActivityClientRecord(IBinder token, Intent intent, int ident,
|
||||||
ActivityInfo info, Configuration overrideConfig, int deviceId,
|
ActivityInfo info, Configuration overrideConfig,
|
||||||
String referrer, IVoiceInteractor voiceInteractor, Bundle state,
|
String referrer, IVoiceInteractor voiceInteractor, Bundle state,
|
||||||
PersistableBundle persistentState, List<ResultInfo> pendingResults,
|
PersistableBundle persistentState, List<ResultInfo> pendingResults,
|
||||||
List<ReferrerIntent> pendingNewIntents, ActivityOptions activityOptions,
|
List<ReferrerIntent> pendingNewIntents, ActivityOptions activityOptions,
|
||||||
@@ -645,7 +642,6 @@ public final class ActivityThread extends ClientTransactionHandler
|
|||||||
this.isForward = isForward;
|
this.isForward = isForward;
|
||||||
this.profilerInfo = profilerInfo;
|
this.profilerInfo = profilerInfo;
|
||||||
this.overrideConfig = overrideConfig;
|
this.overrideConfig = overrideConfig;
|
||||||
this.mDeviceId = deviceId;
|
|
||||||
this.packageInfo = client.getPackageInfoNoCheck(activityInfo.applicationInfo);
|
this.packageInfo = client.getPackageInfoNoCheck(activityInfo.applicationInfo);
|
||||||
mActivityOptions = activityOptions;
|
mActivityOptions = activityOptions;
|
||||||
mLaunchedFromBubble = launchedFromBubble;
|
mLaunchedFromBubble = launchedFromBubble;
|
||||||
@@ -3876,7 +3872,7 @@ public final class ActivityThread extends ClientTransactionHandler
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Activity handleLaunchActivity(ActivityClientRecord r,
|
public Activity handleLaunchActivity(ActivityClientRecord r,
|
||||||
PendingTransactionActions pendingActions, Intent customIntent) {
|
PendingTransactionActions pendingActions, int deviceId, Intent customIntent) {
|
||||||
// If we are getting ready to gc after going to the background, well
|
// If we are getting ready to gc after going to the background, well
|
||||||
// we are back active so skip it.
|
// we are back active so skip it.
|
||||||
unscheduleGcIdler();
|
unscheduleGcIdler();
|
||||||
@@ -3889,7 +3885,7 @@ public final class ActivityThread extends ClientTransactionHandler
|
|||||||
|
|
||||||
// Make sure we are running with the most recent config.
|
// Make sure we are running with the most recent config.
|
||||||
mConfigurationController.handleConfigurationChanged(null, null);
|
mConfigurationController.handleConfigurationChanged(null, null);
|
||||||
updateDeviceIdForNonUIContexts(r.mDeviceId);
|
updateDeviceIdForNonUIContexts(deviceId);
|
||||||
|
|
||||||
if (localLOGV) Slog.v(
|
if (localLOGV) Slog.v(
|
||||||
TAG, "Handling launch of " + r);
|
TAG, "Handling launch of " + r);
|
||||||
@@ -5946,7 +5942,7 @@ public final class ActivityThread extends ClientTransactionHandler
|
|||||||
r.startsNotResumed = startsNotResumed;
|
r.startsNotResumed = startsNotResumed;
|
||||||
r.overrideConfig = overrideConfig;
|
r.overrideConfig = overrideConfig;
|
||||||
|
|
||||||
handleLaunchActivity(r, pendingActions, customIntent);
|
handleLaunchActivity(r, pendingActions, mLastReportedDeviceId, customIntent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -188,7 +188,7 @@ public abstract class ClientTransactionHandler {
|
|||||||
|
|
||||||
/** Perform activity launch. */
|
/** Perform activity launch. */
|
||||||
public abstract Activity handleLaunchActivity(@NonNull ActivityClientRecord r,
|
public abstract Activity handleLaunchActivity(@NonNull ActivityClientRecord r,
|
||||||
PendingTransactionActions pendingActions, Intent customIntent);
|
PendingTransactionActions pendingActions, int deviceId, Intent customIntent);
|
||||||
|
|
||||||
/** Perform activity start. */
|
/** Perform activity start. */
|
||||||
public abstract void handleStartActivity(@NonNull ActivityClientRecord r,
|
public abstract void handleStartActivity(@NonNull ActivityClientRecord r,
|
||||||
|
|||||||
@@ -96,11 +96,11 @@ public class LaunchActivityItem extends ClientTransactionItem {
|
|||||||
PendingTransactionActions pendingActions) {
|
PendingTransactionActions pendingActions) {
|
||||||
Trace.traceBegin(TRACE_TAG_ACTIVITY_MANAGER, "activityStart");
|
Trace.traceBegin(TRACE_TAG_ACTIVITY_MANAGER, "activityStart");
|
||||||
ActivityClientRecord r = new ActivityClientRecord(token, mIntent, mIdent, mInfo,
|
ActivityClientRecord r = new ActivityClientRecord(token, mIntent, mIdent, mInfo,
|
||||||
mOverrideConfig, mDeviceId, mReferrer, mVoiceInteractor, mState, mPersistentState,
|
mOverrideConfig, mReferrer, mVoiceInteractor, mState, mPersistentState,
|
||||||
mPendingResults, mPendingNewIntents, mActivityOptions, mIsForward, mProfilerInfo,
|
mPendingResults, mPendingNewIntents, mActivityOptions, mIsForward, mProfilerInfo,
|
||||||
client, mAssistToken, mShareableActivityToken, mLaunchedFromBubble,
|
client, mAssistToken, mShareableActivityToken, mLaunchedFromBubble,
|
||||||
mTaskFragmentToken);
|
mTaskFragmentToken);
|
||||||
client.handleLaunchActivity(r, pendingActions, null /* customIntent */);
|
client.handleLaunchActivity(r, pendingActions, mDeviceId, null /* customIntent */);
|
||||||
Trace.traceEnd(TRACE_TAG_ACTIVITY_MANAGER);
|
Trace.traceEnd(TRACE_TAG_ACTIVITY_MANAGER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import static android.app.servertransaction.TransactionExecutorHelper.transactio
|
|||||||
|
|
||||||
import android.app.ActivityThread.ActivityClientRecord;
|
import android.app.ActivityThread.ActivityClientRecord;
|
||||||
import android.app.ClientTransactionHandler;
|
import android.app.ClientTransactionHandler;
|
||||||
|
import android.content.Context;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.util.IntArray;
|
import android.util.IntArray;
|
||||||
import android.util.Slog;
|
import android.util.Slog;
|
||||||
@@ -218,7 +219,7 @@ public class TransactionExecutor {
|
|||||||
switch (state) {
|
switch (state) {
|
||||||
case ON_CREATE:
|
case ON_CREATE:
|
||||||
mTransactionHandler.handleLaunchActivity(r, mPendingActions,
|
mTransactionHandler.handleLaunchActivity(r, mPendingActions,
|
||||||
null /* customIntent */);
|
Context.DEVICE_ID_INVALID, null /* customIntent */);
|
||||||
break;
|
break;
|
||||||
case ON_START:
|
case ON_START:
|
||||||
mTransactionHandler.handleStartActivity(r, mPendingActions,
|
mTransactionHandler.handleStartActivity(r, mPendingActions,
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ import android.app.ActivityThread.ActivityClientRecord;
|
|||||||
import android.app.LoadedApk;
|
import android.app.LoadedApk;
|
||||||
import android.app.servertransaction.PendingTransactionActions;
|
import android.app.servertransaction.PendingTransactionActions;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.ActivityInfo;
|
import android.content.pm.ActivityInfo;
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
@@ -293,7 +294,7 @@ public class ActivityThreadClientTest {
|
|||||||
|
|
||||||
private Activity launchActivity(ActivityClientRecord r) {
|
private Activity launchActivity(ActivityClientRecord r) {
|
||||||
return mThread.handleLaunchActivity(r, null /* pendingActions */,
|
return mThread.handleLaunchActivity(r, null /* pendingActions */,
|
||||||
null /* customIntent */);
|
Context.DEVICE_ID_DEFAULT, null /* customIntent */);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startActivity(ActivityClientRecord r) {
|
private void startActivity(ActivityClientRecord r) {
|
||||||
@@ -347,7 +348,7 @@ public class ActivityThreadClientTest {
|
|||||||
doNothing().when(packageInfo).updateApplicationInfo(any(), any());
|
doNothing().when(packageInfo).updateApplicationInfo(any(), any());
|
||||||
|
|
||||||
return new ActivityClientRecord(mock(IBinder.class), Intent.makeMainActivity(component),
|
return new ActivityClientRecord(mock(IBinder.class), Intent.makeMainActivity(component),
|
||||||
0 /* ident */, info, new Configuration(), 0 /*deviceId */, null /* referrer */,
|
0 /* ident */, info, new Configuration(), null /* referrer */,
|
||||||
null /* voiceInteractor */, null /* state */, null /* persistentState */,
|
null /* voiceInteractor */, null /* state */, null /* persistentState */,
|
||||||
null /* pendingResults */, null /* pendingNewIntents */,
|
null /* pendingResults */, null /* pendingNewIntents */,
|
||||||
null /* activityOptions */, true /* isForward */, null /* profilerInfo */,
|
null /* activityOptions */, true /* isForward */, null /* profilerInfo */,
|
||||||
|
|||||||
@@ -1432,8 +1432,7 @@ public class WindowProcessController extends ConfigurationContainer<Configuratio
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
dispatchConfiguration(config, topActivityDeviceChanged ? mLastTopActivityDeviceId
|
dispatchConfiguration(config);
|
||||||
: Context.DEVICE_ID_INVALID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getTopActivityDeviceId() {
|
private int getTopActivityDeviceId() {
|
||||||
@@ -1483,10 +1482,6 @@ public class WindowProcessController extends ConfigurationContainer<Configuratio
|
|||||||
}
|
}
|
||||||
|
|
||||||
void dispatchConfiguration(Configuration config) {
|
void dispatchConfiguration(Configuration config) {
|
||||||
dispatchConfiguration(config, getTopActivityDeviceId());
|
|
||||||
}
|
|
||||||
|
|
||||||
void dispatchConfiguration(Configuration config, int deviceId) {
|
|
||||||
mHasPendingConfigurationChange = false;
|
mHasPendingConfigurationChange = false;
|
||||||
if (mThread == null) {
|
if (mThread == null) {
|
||||||
if (Build.IS_DEBUGGABLE && mHasImeService) {
|
if (Build.IS_DEBUGGABLE && mHasImeService) {
|
||||||
@@ -1513,16 +1508,10 @@ public class WindowProcessController extends ConfigurationContainer<Configuratio
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
scheduleConfigurationChange(mThread, config, deviceId);
|
scheduleConfigurationChange(mThread, config);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void scheduleConfigurationChange(IApplicationThread thread, Configuration config) {
|
private void scheduleConfigurationChange(IApplicationThread thread, Configuration config) {
|
||||||
// By default send invalid deviceId as no-op signal so it's not updated on the client side.
|
|
||||||
scheduleConfigurationChange(thread, config, Context.DEVICE_ID_INVALID);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void scheduleConfigurationChange(IApplicationThread thread, Configuration config,
|
|
||||||
int deviceId) {
|
|
||||||
ProtoLog.v(WM_DEBUG_CONFIGURATION, "Sending to proc %s new config %s", mName,
|
ProtoLog.v(WM_DEBUG_CONFIGURATION, "Sending to proc %s new config %s", mName,
|
||||||
config);
|
config);
|
||||||
if (Build.IS_DEBUGGABLE && mHasImeService) {
|
if (Build.IS_DEBUGGABLE && mHasImeService) {
|
||||||
@@ -1532,7 +1521,7 @@ public class WindowProcessController extends ConfigurationContainer<Configuratio
|
|||||||
mHasCachedConfiguration = false;
|
mHasCachedConfiguration = false;
|
||||||
try {
|
try {
|
||||||
mAtm.getLifecycleManager().scheduleTransaction(thread,
|
mAtm.getLifecycleManager().scheduleTransaction(thread,
|
||||||
ConfigurationChangeItem.obtain(config, deviceId));
|
ConfigurationChangeItem.obtain(config, mLastTopActivityDeviceId));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Slog.e(TAG_CONFIGURATION, "Failed to schedule configuration change: " + mOwner, e);
|
Slog.e(TAG_CONFIGURATION, "Failed to schedule configuration change: " + mOwner, e);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user