Merge "Traverse all leaf task when processing activities visibility"
diff --git a/StubLibraries.bp b/StubLibraries.bp
index 9604466..754c4e9 100644
--- a/StubLibraries.bp
+++ b/StubLibraries.bp
@@ -77,6 +77,7 @@
"android.hardware.vibrator-V1.3-java",
"framework-protos",
],
+ high_mem: true, // Lots of sources => high memory use, see b/170701554
installable: false,
annotations_enabled: true,
previous_api: ":android.api.public.latest",
diff --git a/api/current.txt b/api/current.txt
index 2e15181..b359404 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -47906,6 +47906,7 @@
method @NonNull public java.util.List<java.lang.Integer> getAvailableServices();
method @Nullable public android.telephony.CellIdentity getCellIdentity();
method public int getDomain();
+ method public int getNrState();
method @Nullable public String getRegisteredPlmn();
method public int getTransportType();
method public boolean isRegistered();
diff --git a/core/java/android/app/WindowConfiguration.java b/core/java/android/app/WindowConfiguration.java
index 4ae1670..c4af4ed 100644
--- a/core/java/android/app/WindowConfiguration.java
+++ b/core/java/android/app/WindowConfiguration.java
@@ -796,6 +796,9 @@
/**
* Returns {@code true} if the windowingMode represents a window in multi-window mode.
* I.e. sharing the screen with another activity.
+ *
+ * TODO(b/171672645): This API could be misleading - in 'undefined' mode it's determined by the
+ * parent's mode
* @hide
*/
public static boolean inMultiWindowMode(int windowingMode) {
diff --git a/core/java/android/util/EventLog.java b/core/java/android/util/EventLog.java
index ee98b65..a7d20b5 100644
--- a/core/java/android/util/EventLog.java
+++ b/core/java/android/util/EventLog.java
@@ -64,7 +64,7 @@
private Exception mLastWtf;
// Layout of event log entry received from Android logger.
- // see system/core/liblog/include/log/log_read.h
+ // see system/logging/liblog/include/log/log_read.h
private static final int LENGTH_OFFSET = 0;
private static final int HEADER_SIZE_OFFSET = 2;
private static final int PROCESS_OFFSET = 4;
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 8a7fa04..7d20de9 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -668,6 +668,10 @@
<!-- For tether entitlement recheck-->
<protected-broadcast
android:name="com.android.server.connectivity.tethering.PROVISIONING_RECHECK_ALARM" />
+
+ <!-- Made protected in S (was added in R) -->
+ <protected-broadcast android:name="com.android.internal.intent.action.BUGREPORT_REQUESTED" />
+
<!-- ====================================================================== -->
<!-- RUNTIME PERMISSIONS -->
<!-- ====================================================================== -->
diff --git a/non-updatable-api/current.txt b/non-updatable-api/current.txt
index 6bfa2f3..8adedf5 100644
--- a/non-updatable-api/current.txt
+++ b/non-updatable-api/current.txt
@@ -46032,6 +46032,7 @@
method @NonNull public java.util.List<java.lang.Integer> getAvailableServices();
method @Nullable public android.telephony.CellIdentity getCellIdentity();
method public int getDomain();
+ method public int getNrState();
method @Nullable public String getRegisteredPlmn();
method public int getTransportType();
method public boolean isRegistered();
diff --git a/services/core/java/com/android/server/connectivity/DataConnectionStats.java b/services/core/java/com/android/server/connectivity/DataConnectionStats.java
index 15f43a0..fbd089c 100644
--- a/services/core/java/com/android/server/connectivity/DataConnectionStats.java
+++ b/services/core/java/com/android/server/connectivity/DataConnectionStats.java
@@ -52,7 +52,6 @@
private SignalStrength mSignalStrength;
private ServiceState mServiceState;
private int mDataState = TelephonyManager.DATA_DISCONNECTED;
- private int mNrState = NetworkRegistrationInfo.NR_STATE_NONE;
public DataConnectionStats(Context context, Handler listenerHandler) {
mContext = context;
@@ -100,7 +99,7 @@
: regInfo.getAccessNetworkTechnology();
// If the device is in NSA NR connection the networkType will report as LTE.
// For cell dwell rate metrics, this should report NR instead.
- if (mNrState == NetworkRegistrationInfo.NR_STATE_CONNECTED) {
+ if (regInfo != null && regInfo.getNrState() == NetworkRegistrationInfo.NR_STATE_CONNECTED) {
networkType = TelephonyManager.NETWORK_TYPE_NR;
}
if (DEBUG) Log.d(TAG, String.format("Noting data connection for network type %s: %svisible",
@@ -172,7 +171,6 @@
@Override
public void onServiceStateChanged(ServiceState state) {
mServiceState = state;
- mNrState = state.getNrState();
notePhoneDataConnectionState();
}
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecNetwork.java b/services/core/java/com/android/server/hdmi/HdmiCecNetwork.java
index 4163024..5d75a63 100644
--- a/services/core/java/com/android/server/hdmi/HdmiCecNetwork.java
+++ b/services/core/java/com/android/server/hdmi/HdmiCecNetwork.java
@@ -18,6 +18,7 @@
import static com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly;
+import android.annotation.Nullable;
import android.hardware.hdmi.HdmiControlManager;
import android.hardware.hdmi.HdmiDeviceInfo;
import android.hardware.hdmi.HdmiPortInfo;
@@ -242,6 +243,7 @@
* Returns null if no logical address matched
*/
@ServiceThreadOnly
+ @Nullable
HdmiDeviceInfo getCecDeviceInfo(int logicalAddress) {
assertRunOnServiceThread();
return mDeviceInfos.get(HdmiDeviceInfo.idForCecDevice(logicalAddress));
@@ -517,6 +519,10 @@
case Constants.MESSAGE_SET_OSD_NAME:
handleSetOsdName(message);
break;
+ case Constants.MESSAGE_DEVICE_VENDOR_ID:
+ handleDeviceVendorId(message);
+ break;
+
}
}
@@ -582,6 +588,24 @@
deviceInfo.getDevicePowerStatus()));
}
+ @ServiceThreadOnly
+ private void handleDeviceVendorId(HdmiCecMessage message) {
+ assertRunOnServiceThread();
+ int logicalAddress = message.getSource();
+ int vendorId = HdmiUtils.threeBytesToInt(message.getParams());
+
+ HdmiDeviceInfo deviceInfo = getCecDeviceInfo(logicalAddress);
+ if (deviceInfo == null) {
+ Slog.i(TAG, "Unknown source device info for <Device Vendor ID> " + message);
+ } else {
+ HdmiDeviceInfo updatedDeviceInfo = new HdmiDeviceInfo(deviceInfo.getLogicalAddress(),
+ deviceInfo.getPhysicalAddress(),
+ deviceInfo.getPortId(), deviceInfo.getDeviceType(), vendorId,
+ deviceInfo.getDisplayName(), deviceInfo.getDevicePowerStatus());
+ updateCecDevice(updatedDeviceInfo);
+ }
+ }
+
void addCecSwitch(int physicalAddress) {
mCecSwitches.add(physicalAddress);
}
diff --git a/services/core/java/com/android/server/wm/ActivityMetricsLogger.java b/services/core/java/com/android/server/wm/ActivityMetricsLogger.java
index 9d08b1b..f50ce1ab8e8 100644
--- a/services/core/java/com/android/server/wm/ActivityMetricsLogger.java
+++ b/services/core/java/com/android/server/wm/ActivityMetricsLogger.java
@@ -131,7 +131,6 @@
*/
private static final int IGNORE_CALLER = -1;
private static final int INVALID_DELAY = -1;
- private static final int INVALID_TRANSITION_TYPE = -1;
// Preallocated strings we are sending to tron, so we don't have to allocate a new one every
// time we log.
@@ -232,22 +231,19 @@
static TransitionInfo create(@NonNull ActivityRecord r,
@NonNull LaunchingState launchingState, @Nullable ActivityOptions options,
boolean processRunning, boolean processSwitch, int startResult) {
- int transitionType = INVALID_TRANSITION_TYPE;
+ if (startResult != START_SUCCESS && startResult != START_TASK_TO_FRONT) {
+ return null;
+ }
+ final int transitionType;
if (processRunning) {
- if (startResult == START_SUCCESS) {
- transitionType = TYPE_TRANSITION_WARM_LAUNCH;
- } else if (startResult == START_TASK_TO_FRONT) {
- transitionType = TYPE_TRANSITION_HOT_LAUNCH;
- }
- } else if (startResult == START_SUCCESS || startResult == START_TASK_TO_FRONT) {
+ transitionType = r.attachedToProcess()
+ ? TYPE_TRANSITION_HOT_LAUNCH
+ : TYPE_TRANSITION_WARM_LAUNCH;
+ } else {
// Task may still exist when cold launching an activity and the start result will be
// set to START_TASK_TO_FRONT. Treat this as a COLD launch.
transitionType = TYPE_TRANSITION_COLD_LAUNCH;
}
- if (transitionType == INVALID_TRANSITION_TYPE) {
- // That means the startResult is neither START_SUCCESS nor START_TASK_TO_FRONT.
- return null;
- }
return new TransitionInfo(r, launchingState, options, transitionType, processRunning,
processSwitch);
}
diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java
index 6de5522..0a7f08b 100644
--- a/services/core/java/com/android/server/wm/ActivityRecord.java
+++ b/services/core/java/com/android/server/wm/ActivityRecord.java
@@ -499,7 +499,6 @@
// process that it is hidden.
private boolean mLastDeferHidingClient; // If true we will defer setting mClientVisible to false
// and reporting to the client that it is hidden.
- private boolean mSetToSleep; // have we told the activity to sleep?
boolean nowVisible; // is this activity's window visible?
boolean mClientVisibilityDeferred;// was the visibility change message to client deferred?
boolean idle; // has the activity gone idle?
@@ -906,7 +905,6 @@
pw.print(" finishing="); pw.println(finishing);
pw.print(prefix); pw.print("keysPaused="); pw.print(keysPaused);
pw.print(" inHistory="); pw.print(inHistory);
- pw.print(" setToSleep="); pw.print(mSetToSleep);
pw.print(" idle="); pw.print(idle);
pw.print(" mStartingWindowState=");
pw.println(startingWindowStateToString(mStartingWindowState));
@@ -4682,14 +4680,13 @@
return false;
}
- // Check if the activity is on a sleeping display
- // TODO b/163993448 mSetToSleep is required when restarting an existing activity, try to
- // remove it if possible.
- if (mSetToSleep && mDisplayContent.isSleeping()) {
- return false;
+ // Check if the activity is on a sleeping display, canTurnScreenOn will also check
+ // keyguard visibility
+ if (mDisplayContent.isSleeping()) {
+ return canTurnScreenOn();
+ } else {
+ return mStackSupervisor.getKeyguardController().checkKeyguardVisibility(this);
}
-
- return mStackSupervisor.getKeyguardController().checkKeyguardVisibility(this);
}
void updateVisibilityIgnoringKeyguard(boolean behindFullscreenActivity) {
@@ -4726,7 +4723,6 @@
stack.mUndrawnActivitiesBelowTopTranslucent.add(this);
}
setVisibility(true);
- mSetToSleep = false;
app.postPendingUiCleanMsg(true);
if (reportToClient) {
mClientVisibilityDeferred = false;
@@ -5125,9 +5121,6 @@
mAtmService.getLifecycleManager().scheduleTransaction(app.getThread(), appToken,
StopActivityItem.obtain(configChangeFlags));
- if (stack.shouldSleepOrShutDownActivities()) {
- setSleeping(true);
- }
mAtmService.mH.postDelayed(mStopTimeoutRunnable, STOP_TIMEOUT);
} catch (Exception e) {
// Maybe just ignore exceptions here... if the process has crashed, our death
@@ -5718,10 +5711,6 @@
return mVisibleRequested || nowVisible || mState == PAUSING || mState == RESUMED;
}
- void setSleeping(boolean sleeping) {
- mSetToSleep = sleeping;
- }
-
static int getTaskForActivityLocked(IBinder token, boolean onlyRoot) {
final ActivityRecord r = ActivityRecord.forTokenLocked(token);
if (r == null || r.getParent() == null) {
@@ -7568,7 +7557,7 @@
return false;
}
final Task stack = getRootTask();
- return stack != null
+ return mCurrentLaunchCanTurnScreenOn && stack != null
&& mStackSupervisor.getKeyguardController().checkKeyguardVisibility(this);
}
diff --git a/services/core/java/com/android/server/wm/ActivityStackSupervisor.java b/services/core/java/com/android/server/wm/ActivityStackSupervisor.java
index a8079cf..a068d2b 100644
--- a/services/core/java/com/android/server/wm/ActivityStackSupervisor.java
+++ b/services/core/java/com/android/server/wm/ActivityStackSupervisor.java
@@ -820,7 +820,6 @@
}
mService.getPackageManagerInternalLocked().notifyPackageUse(
r.intent.getComponent().getPackageName(), NOTIFY_PACKAGE_USE_ACTIVITY);
- r.setSleeping(false);
r.forceNewConfig = false;
mService.getAppWarningsLocked().onStartActivity(r);
r.compat = mService.compatibilityInfoForPackageLocked(r.info.applicationInfo);
diff --git a/services/core/java/com/android/server/wm/ActivityStarter.java b/services/core/java/com/android/server/wm/ActivityStarter.java
index c8a8f81..910a1a2 100644
--- a/services/core/java/com/android/server/wm/ActivityStarter.java
+++ b/services/core/java/com/android/server/wm/ActivityStarter.java
@@ -2546,6 +2546,10 @@
private void resumeTargetStackIfNeeded() {
if (mDoResume) {
+ final ActivityRecord next = mTargetStack.topRunningActivity(true /* focusableOnly */);
+ if (next != null) {
+ next.setCurrentLaunchCanTurnScreenOn(true);
+ }
mRootWindowContainer.resumeFocusedStacksTopActivities(mTargetStack, null, mOptions);
} else {
ActivityOptions.abort(mOptions);
diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
index 8e5add9..c582e6c 100644
--- a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
+++ b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
@@ -39,6 +39,7 @@
import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
import static android.content.Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS;
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
+import static android.content.pm.ActivityInfo.RESIZE_MODE_UNRESIZEABLE;
import static android.content.pm.ApplicationInfo.FLAG_FACTORY_TEST;
import static android.content.pm.ConfigurationInfo.GL_ES_VERSION_UNDEFINED;
import static android.content.pm.PackageManager.FEATURE_ACTIVITIES_ON_SECONDARY_DISPLAYS;
@@ -1295,6 +1296,7 @@
a.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
a.colorMode = ActivityInfo.COLOR_MODE_DEFAULT;
a.flags |= ActivityInfo.FLAG_EXCLUDE_FROM_RECENTS;
+ a.resizeMode = RESIZE_MODE_UNRESIZEABLE;
final ActivityOptions options = ActivityOptions.makeBasic();
options.setLaunchActivityType(ACTIVITY_TYPE_DREAM);
diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java
index 8da6c81..7641de5 100644
--- a/services/core/java/com/android/server/wm/DisplayContent.java
+++ b/services/core/java/com/android/server/wm/DisplayContent.java
@@ -5018,6 +5018,13 @@
|| windowingMode == WINDOWING_MODE_MULTI_WINDOW);
}
+ static boolean canReuseExistingTask(int windowingMode, int activityType) {
+ // Existing Tasks can be reused if a new stack will be created anyway, or for the Dream -
+ // because there can only ever be one DreamActivity.
+ return alwaysCreateStack(windowingMode, activityType)
+ || activityType == ACTIVITY_TYPE_DREAM;
+ }
+
@Nullable
Task getFocusedStack() {
return getItemFromTaskDisplayAreas(TaskDisplayArea::getFocusedStack);
diff --git a/services/core/java/com/android/server/wm/RootWindowContainer.java b/services/core/java/com/android/server/wm/RootWindowContainer.java
index c1e518b..04b3030 100644
--- a/services/core/java/com/android/server/wm/RootWindowContainer.java
+++ b/services/core/java/com/android/server/wm/RootWindowContainer.java
@@ -55,6 +55,7 @@
import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
import static com.android.server.wm.ActivityStackSupervisor.DEFER_RESUME;
import static com.android.server.wm.ActivityStackSupervisor.ON_TOP;
+import static com.android.server.wm.ActivityStackSupervisor.PRESERVE_WINDOWS;
import static com.android.server.wm.ActivityStackSupervisor.dumpHistoryList;
import static com.android.server.wm.ActivityStackSupervisor.printThisActivity;
import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_RECENTS;
@@ -2779,7 +2780,8 @@
if (allowDelay) {
result &= stack.goToSleepIfPossible(shuttingDown);
} else {
- stack.goToSleep();
+ stack.ensureActivitiesVisible(null /* starting */, 0 /* configChanges */,
+ !PRESERVE_WINDOWS);
}
}
return result;
diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java
index ab38caf..ef1a3be 100644
--- a/services/core/java/com/android/server/wm/Task.java
+++ b/services/core/java/com/android/server/wm/Task.java
@@ -2836,16 +2836,25 @@
int windowingMode =
getResolvedOverrideConfiguration().windowConfiguration.getWindowingMode();
+ final int parentWindowingMode = newParentConfig.windowConfiguration.getWindowingMode();
// Resolve override windowing mode to fullscreen for home task (even on freeform
// display), or split-screen if in split-screen mode.
if (getActivityType() == ACTIVITY_TYPE_HOME && windowingMode == WINDOWING_MODE_UNDEFINED) {
- final int parentWindowingMode = newParentConfig.windowConfiguration.getWindowingMode();
windowingMode = WindowConfiguration.isSplitScreenWindowingMode(parentWindowingMode)
? parentWindowingMode : WINDOWING_MODE_FULLSCREEN;
getResolvedOverrideConfiguration().windowConfiguration.setWindowingMode(windowingMode);
}
+ // Do not allow non-resizable non-pinned tasks to be in a multi-window mode - they should
+ // use their parent's windowing mode, or fullscreen.
+ if (!isResizeable() && windowingMode != WINDOWING_MODE_PINNED
+ && WindowConfiguration.inMultiWindowMode(windowingMode)) {
+ windowingMode = WindowConfiguration.inMultiWindowMode(parentWindowingMode)
+ ? WINDOWING_MODE_FULLSCREEN : parentWindowingMode;
+ getResolvedOverrideConfiguration().windowConfiguration.setWindowingMode(windowingMode);
+ }
+
if (isLeafTask()) {
resolveLeafOnlyOverrideConfigs(newParentConfig, mTmpBounds /* previousBounds */);
}
@@ -3362,7 +3371,9 @@
}
boolean isResizeable(boolean checkSupportsPip) {
- return (mAtmService.mForceResizableActivities || ActivityInfo.isResizeableMode(mResizeMode)
+ final boolean forceResizable = mAtmService.mForceResizableActivities
+ && getActivityType() == ACTIVITY_TYPE_STANDARD;
+ return (forceResizable || ActivityInfo.isResizeableMode(mResizeMode)
|| (checkSupportsPip && mSupportsPictureInPicture));
}
@@ -5403,8 +5414,6 @@
}
void awakeFromSleepingLocked() {
- // Ensure activities are no longer sleeping.
- forAllActivities((Consumer<ActivityRecord>) (r) -> r.setSleeping(false));
if (mPausingActivity != null) {
Slog.d(TAG, "awakeFromSleepingLocked: previously pausing activity didn't pause");
mPausingActivity.activityPaused(true);
@@ -5458,27 +5467,13 @@
}
if (shouldSleep) {
- goToSleep();
+ ensureActivitiesVisible(null /* starting */, 0 /* configChanges */,
+ !PRESERVE_WINDOWS);
}
return shouldSleep;
}
- void goToSleep() {
- // Make sure all visible activities are now sleeping. This will update the activity's
- // visibility and onStop() will be called.
- forAllActivities((r) -> {
- if (r.isState(STARTED, RESUMED, PAUSING, PAUSED, STOPPING, STOPPED)) {
- r.setSleeping(true);
- }
- });
-
- // Ensure visibility after updating sleep states without updating configuration,
- // as activities are about to be sent to sleep.
- ensureActivitiesVisible(null /* starting */, 0 /* configChanges */,
- !PRESERVE_WINDOWS);
- }
-
private boolean containsActivityFromStack(List<ActivityRecord> rs) {
for (ActivityRecord r : rs) {
if (r.getRootTask() == this) {
@@ -5964,6 +5959,8 @@
if (mResumedActivity == next && next.isState(RESUMED)
&& taskDisplayArea.getWindowingMode() != WINDOWING_MODE_FREEFORM
&& taskDisplayArea.allResumedActivitiesComplete()) {
+ // The activity may be waiting for stop, but that is no longer appropriate for it.
+ mStackSupervisor.mStoppingActivities.remove(next);
// Make sure we have executed any pending transitions, since there
// should be nothing left to do at this point.
executeAppTransition(options);
@@ -6010,7 +6007,6 @@
// The activity may be waiting for stop, but that is no longer
// appropriate for it.
mStackSupervisor.mStoppingActivities.remove(next);
- next.setSleeping(false);
if (DEBUG_SWITCH) Slog.v(TAG_SWITCH, "Resuming " + next);
@@ -6283,7 +6279,6 @@
EventLogTags.writeWmResumeActivity(next.mUserId, System.identityHashCode(next),
next.getTask().mTaskId, next.shortComponentName);
- next.setSleeping(false);
mAtmService.getAppWarningsLocked().onResumeActivity(next);
next.app.setPendingUiCleanAndForceProcessStateUpTo(mAtmService.mTopProcessState);
next.clearOptionsLocked();
@@ -7242,7 +7237,7 @@
ActivityRecord source, ActivityOptions options) {
Task task;
- if (DisplayContent.alwaysCreateStack(getWindowingMode(), getActivityType())) {
+ if (DisplayContent.canReuseExistingTask(getWindowingMode(), getActivityType())) {
// This stack will only contain one task, so just return itself since all stacks ara now
// tasks and all tasks are now stacks.
task = reuseAsLeafTask(voiceSession, voiceInteractor, intent, info, activity);
diff --git a/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecNetworkTest.java b/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecNetworkTest.java
index 4f18582..080b52b 100644
--- a/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecNetworkTest.java
+++ b/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecNetworkTest.java
@@ -285,12 +285,34 @@
}
@Test
+ public void cecDevices_tracking_reportVendorId() {
+ int logicalAddress = Constants.ADDR_PLAYBACK_1;
+ int vendorId = 1234;
+ mHdmiCecNetwork.handleCecMessage(
+ HdmiCecMessageBuilder.buildDeviceVendorIdCommand(logicalAddress, vendorId));
+
+ assertThat(mHdmiCecNetwork.getSafeCecDevicesLocked()).hasSize(1);
+
+ HdmiDeviceInfo cecDeviceInfo = mHdmiCecNetwork.getCecDeviceInfo(logicalAddress);
+ assertThat(cecDeviceInfo.getLogicalAddress()).isEqualTo(logicalAddress);
+ assertThat(cecDeviceInfo.getPhysicalAddress()).isEqualTo(
+ Constants.INVALID_PHYSICAL_ADDRESS);
+ assertThat(cecDeviceInfo.getDeviceType()).isEqualTo(HdmiDeviceInfo.DEVICE_RESERVED);
+ assertThat(cecDeviceInfo.getDisplayName()).isEqualTo(
+ HdmiUtils.getDefaultDeviceName(logicalAddress));
+ assertThat(cecDeviceInfo.getVendorId()).isEqualTo(vendorId);
+ assertThat(cecDeviceInfo.getDevicePowerStatus()).isEqualTo(
+ HdmiControlManager.POWER_STATUS_UNKNOWN);
+ }
+
+ @Test
public void cecDevices_tracking_updatesDeviceInfo() {
int logicalAddress = Constants.ADDR_PLAYBACK_1;
int physicalAddress = 0x1000;
int type = HdmiDeviceInfo.DEVICE_PLAYBACK;
int powerStatus = HdmiControlManager.POWER_STATUS_ON;
String osdName = "Test Device";
+ int vendorId = 1234;
mHdmiCecNetwork.handleCecMessage(
HdmiCecMessageBuilder.buildReportPhysicalAddressCommand(logicalAddress,
@@ -301,6 +323,8 @@
mHdmiCecNetwork.handleCecMessage(
HdmiCecMessageBuilder.buildSetOsdNameCommand(logicalAddress,
Constants.ADDR_BROADCAST, osdName));
+ mHdmiCecNetwork.handleCecMessage(
+ HdmiCecMessageBuilder.buildDeviceVendorIdCommand(logicalAddress, vendorId));
assertThat(mHdmiCecNetwork.getSafeCecDevicesLocked()).hasSize(1);
@@ -309,6 +333,7 @@
assertThat(cecDeviceInfo.getPhysicalAddress()).isEqualTo(physicalAddress);
assertThat(cecDeviceInfo.getDeviceType()).isEqualTo(type);
assertThat(cecDeviceInfo.getDisplayName()).isEqualTo(osdName);
+ assertThat(cecDeviceInfo.getVendorId()).isEqualTo(vendorId);
assertThat(cecDeviceInfo.getDevicePowerStatus()).isEqualTo(powerStatus);
}
@@ -382,6 +407,30 @@
}
@Test
+ public void cecDevices_tracking_updatesVendorId() {
+ int logicalAddress = Constants.ADDR_PLAYBACK_1;
+ int vendorId = 1234;
+ int updatedVendorId = 12345;
+ mHdmiCecNetwork.handleCecMessage(
+ HdmiCecMessageBuilder.buildDeviceVendorIdCommand(logicalAddress, vendorId));
+ mHdmiCecNetwork.handleCecMessage(
+ HdmiCecMessageBuilder.buildDeviceVendorIdCommand(logicalAddress, updatedVendorId));
+
+ assertThat(mHdmiCecNetwork.getSafeCecDevicesLocked()).hasSize(1);
+
+ HdmiDeviceInfo cecDeviceInfo = mHdmiCecNetwork.getCecDeviceInfo(logicalAddress);
+ assertThat(cecDeviceInfo.getLogicalAddress()).isEqualTo(logicalAddress);
+ assertThat(cecDeviceInfo.getPhysicalAddress()).isEqualTo(
+ Constants.INVALID_PHYSICAL_ADDRESS);
+ assertThat(cecDeviceInfo.getDeviceType()).isEqualTo(HdmiDeviceInfo.DEVICE_RESERVED);
+ assertThat(cecDeviceInfo.getDisplayName()).isEqualTo(
+ HdmiUtils.getDefaultDeviceName(logicalAddress));
+ assertThat(cecDeviceInfo.getVendorId()).isEqualTo(updatedVendorId);
+ assertThat(cecDeviceInfo.getDevicePowerStatus()).isEqualTo(
+ HdmiControlManager.POWER_STATUS_UNKNOWN);
+ }
+
+ @Test
public void cecDevices_tracking_clearDevices() {
int logicalAddress = Constants.ADDR_PLAYBACK_1;
mHdmiCecNetwork.handleCecMessage(
diff --git a/services/tests/servicestests/src/com/android/server/pm/ApexManagerTest.java b/services/tests/servicestests/src/com/android/server/pm/ApexManagerTest.java
index 72afca0..9b25d0d 100644
--- a/services/tests/servicestests/src/com/android/server/pm/ApexManagerTest.java
+++ b/services/tests/servicestests/src/com/android/server/pm/ApexManagerTest.java
@@ -45,6 +45,7 @@
import com.android.server.pm.parsing.PackageParser2;
import com.android.server.pm.parsing.TestPackageParser2;
+import com.android.server.pm.parsing.pkg.AndroidPackage;
import org.junit.Before;
import org.junit.Test;
@@ -288,6 +289,31 @@
assertThat(mApexManager.isApkInApexInstallSuccess(activeApex.apexModuleName)).isFalse();
}
+ /**
+ * registerApkInApex method checks if the prefix of base apk path contains the apex package
+ * name. When an apex package name is a prefix of another apex package name, e.g,
+ * com.android.media and com.android.mediaprovider, then we need to ensure apk inside apex
+ * mediaprovider does not get registered under apex media.
+ */
+ @Test
+ public void testRegisterApkInApexDoesNotRegisterSimilarPrefix() throws RemoteException {
+ when(mApexService.getActivePackages()).thenReturn(createApexInfo(true, true));
+ final ApexManager.ActiveApexInfo activeApex = mApexManager.getActiveApexInfos().get(0);
+ assertThat(activeApex.apexModuleName).isEqualTo(TEST_APEX_PKG);
+
+ AndroidPackage fakeApkInApex = mock(AndroidPackage.class);
+ when(fakeApkInApex.getBaseApkPath()).thenReturn("/apex/" + TEST_APEX_PKG + "randomSuffix");
+ when(fakeApkInApex.getPackageName()).thenReturn("randomPackageName");
+
+ when(mApexService.getAllPackages()).thenReturn(createApexInfo(true, true));
+ mApexManager.scanApexPackagesTraced(mPackageParser2,
+ ParallelPackageParser.makeExecutorService());
+
+ assertThat(mApexManager.getApksInApex(activeApex.apexModuleName)).isEmpty();
+ mApexManager.registerApkInApex(fakeApkInApex);
+ assertThat(mApexManager.getApksInApex(activeApex.apexModuleName)).isEmpty();
+ }
+
private ApexInfo[] createApexInfo(boolean isActive, boolean isFactory) {
File apexFile = extractResource(TEST_APEX_PKG, TEST_APEX_FILE_NAME);
ApexInfo apexInfo = new ApexInfo();
diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityMetricsLaunchObserverTests.java b/services/tests/wmtests/src/com/android/server/wm/ActivityMetricsLaunchObserverTests.java
index 9be3164..f1d3e18 100644
--- a/services/tests/wmtests/src/com/android/server/wm/ActivityMetricsLaunchObserverTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/ActivityMetricsLaunchObserverTests.java
@@ -35,6 +35,7 @@
import android.app.ActivityOptions;
import android.app.ActivityOptions.SourceInfo;
+import android.app.WaitResult;
import android.content.Intent;
import android.os.SystemClock;
import android.platform.test.annotations.Presubmit;
@@ -167,10 +168,15 @@
@Test
public void testOnActivityLaunchFinished() {
+ // Assume that the process is started (ActivityBuilder has mocked the returned value of
+ // ATMS#getProcessController) but the activity has not attached process.
+ mTopActivity.app = null;
onActivityLaunched(mTopActivity);
notifyTransitionStarting(mTopActivity);
- notifyWindowsDrawn(mTopActivity);
+ final ActivityMetricsLogger.TransitionInfoSnapshot info = notifyWindowsDrawn(mTopActivity);
+ assertWithMessage("Warm launch").that(info.getLaunchState())
+ .isEqualTo(WaitResult.LAUNCH_STATE_WARM);
verifyOnActivityLaunchFinished(mTopActivity);
verifyNoMoreInteractions(mLaunchObserver);
@@ -204,7 +210,7 @@
notifyActivityLaunching(noDrawnActivity.intent);
notifyActivityLaunched(START_SUCCESS, noDrawnActivity);
- noDrawnActivity.destroyIfPossible("test");
+ noDrawnActivity.mVisibleRequested = false;
mActivityMetricsLogger.notifyVisibilityChanged(noDrawnActivity);
verifyAsync(mLaunchObserver).onActivityLaunchCancelled(eqProto(noDrawnActivity));
@@ -225,6 +231,8 @@
assertWithMessage("Record start source").that(info.sourceType)
.isEqualTo(SourceInfo.TYPE_LAUNCHER);
assertWithMessage("Record event time").that(info.sourceEventDelayMs).isAtLeast(10);
+ assertWithMessage("Hot launch").that(info.getLaunchState())
+ .isEqualTo(WaitResult.LAUNCH_STATE_HOT);
verifyAsync(mLaunchObserver).onReportFullyDrawn(eqProto(mTopActivity), anyLong());
verifyOnActivityLaunchFinished(mTopActivity);
diff --git a/telephony/java/android/telephony/NetworkRegistrationInfo.java b/telephony/java/android/telephony/NetworkRegistrationInfo.java
index 9223842..f8a200a 100644
--- a/telephony/java/android/telephony/NetworkRegistrationInfo.java
+++ b/telephony/java/android/telephony/NetworkRegistrationInfo.java
@@ -369,7 +369,6 @@
* Get the 5G NR connection state.
*
* @return the 5G NR connection state.
- * @hide
*/
public @NRState int getNrState() {
return mNrState;