Merge changes Ifece2dc6,Id0c37612 into tm-qpr-dev am: 3dad16a68c
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20313650 Change-Id: I6be560ab366bd8bbb6ece691c7e7fbe1af31a358 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package android.service.dreams;
|
package android.service.dreams;
|
||||||
|
|
||||||
import android.content.ComponentName;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dream manager local system service interface.
|
* Dream manager local system service interface.
|
||||||
@@ -59,19 +58,4 @@ public abstract class DreamManagerInternal {
|
|||||||
* @param isScreenOn True if the screen is currently on.
|
* @param isScreenOn True if the screen is currently on.
|
||||||
*/
|
*/
|
||||||
public abstract boolean canStartDreaming(boolean isScreenOn);
|
public abstract boolean canStartDreaming(boolean isScreenOn);
|
||||||
|
|
||||||
/**
|
|
||||||
* Called by the ActivityTaskManagerService to verify that the startDreamActivity
|
|
||||||
* request comes from the current active dream component.
|
|
||||||
*
|
|
||||||
* This function and its call path should not acquire the DreamManagerService lock
|
|
||||||
* to avoid deadlock with the ActivityTaskManager lock.
|
|
||||||
*
|
|
||||||
* TODO: Make this interaction push-based - the DreamManager should inform the
|
|
||||||
* ActivityTaskManager whenever the active dream component changes.
|
|
||||||
*
|
|
||||||
* @param doze If true returns the current active doze component. Otherwise, returns the
|
|
||||||
* active dream component.
|
|
||||||
*/
|
|
||||||
public abstract ComponentName getActiveDreamComponent(boolean doze);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1327,6 +1327,12 @@
|
|||||||
"group": "WM_DEBUG_ANIM",
|
"group": "WM_DEBUG_ANIM",
|
||||||
"at": "com\/android\/server\/wm\/WindowState.java"
|
"at": "com\/android\/server\/wm\/WindowState.java"
|
||||||
},
|
},
|
||||||
|
"-787664727": {
|
||||||
|
"message": "Cannot launch dream activity due to invalid state. dream component: %s packageName: %s",
|
||||||
|
"level": "ERROR",
|
||||||
|
"group": "WM_DEBUG_DREAM",
|
||||||
|
"at": "com\/android\/server\/wm\/ActivityTaskManagerService.java"
|
||||||
|
},
|
||||||
"-784959154": {
|
"-784959154": {
|
||||||
"message": "Attempted to add private presentation window to a non-private display. Aborting.",
|
"message": "Attempted to add private presentation window to a non-private display. Aborting.",
|
||||||
"level": "WARN",
|
"level": "WARN",
|
||||||
@@ -2863,6 +2869,12 @@
|
|||||||
"group": "WM_DEBUG_BOOT",
|
"group": "WM_DEBUG_BOOT",
|
||||||
"at": "com\/android\/server\/wm\/WindowManagerService.java"
|
"at": "com\/android\/server\/wm\/WindowManagerService.java"
|
||||||
},
|
},
|
||||||
|
"601283564": {
|
||||||
|
"message": "Dream packageName does not match active dream. Package %s does not match %s",
|
||||||
|
"level": "ERROR",
|
||||||
|
"group": "WM_DEBUG_DREAM",
|
||||||
|
"at": "com\/android\/server\/wm\/ActivityTaskManagerService.java"
|
||||||
|
},
|
||||||
"608694300": {
|
"608694300": {
|
||||||
"message": " NEW SURFACE SESSION %s",
|
"message": " NEW SURFACE SESSION %s",
|
||||||
"level": "INFO",
|
"level": "INFO",
|
||||||
@@ -3103,12 +3115,6 @@
|
|||||||
"group": "WM_DEBUG_STARTING_WINDOW",
|
"group": "WM_DEBUG_STARTING_WINDOW",
|
||||||
"at": "com\/android\/server\/wm\/WindowStateAnimator.java"
|
"at": "com\/android\/server\/wm\/WindowStateAnimator.java"
|
||||||
},
|
},
|
||||||
"829869827": {
|
|
||||||
"message": "Cannot launch dream activity due to invalid state. dreaming: %b packageName: %s",
|
|
||||||
"level": "ERROR",
|
|
||||||
"group": "WM_DEBUG_DREAM",
|
|
||||||
"at": "com\/android\/server\/wm\/ActivityTaskManagerService.java"
|
|
||||||
},
|
|
||||||
"835814848": {
|
"835814848": {
|
||||||
"message": "%s",
|
"message": "%s",
|
||||||
"level": "INFO",
|
"level": "INFO",
|
||||||
@@ -4141,12 +4147,6 @@
|
|||||||
"group": "WM_DEBUG_WINDOW_ORGANIZER",
|
"group": "WM_DEBUG_WINDOW_ORGANIZER",
|
||||||
"at": "com\/android\/server\/wm\/TaskOrganizerController.java"
|
"at": "com\/android\/server\/wm\/TaskOrganizerController.java"
|
||||||
},
|
},
|
||||||
"1918771553": {
|
|
||||||
"message": "Dream packageName does not match active dream. Package %s does not match %s or %s",
|
|
||||||
"level": "ERROR",
|
|
||||||
"group": "WM_DEBUG_DREAM",
|
|
||||||
"at": "com\/android\/server\/wm\/ActivityTaskManagerService.java"
|
|
||||||
},
|
|
||||||
"1921821199": {
|
"1921821199": {
|
||||||
"message": "Preserving %s until the new one is added",
|
"message": "Preserving %s until the new one is added",
|
||||||
"level": "VERBOSE",
|
"level": "VERBOSE",
|
||||||
|
|||||||
@@ -491,10 +491,6 @@ public final class DreamManagerService extends SystemService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ComponentName getActiveDreamComponentInternal(boolean doze) {
|
|
||||||
return chooseDreamForUser(doze, ActivityManager.getCurrentUser());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If doze is true, returns the doze component for the user.
|
* If doze is true, returns the doze component for the user.
|
||||||
* Otherwise, returns the system dream component, if present.
|
* Otherwise, returns the system dream component, if present.
|
||||||
@@ -647,7 +643,7 @@ public final class DreamManagerService extends SystemService {
|
|||||||
.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, DREAM_WAKE_LOCK_TAG);
|
.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, DREAM_WAKE_LOCK_TAG);
|
||||||
final Binder dreamToken = mCurrentDream.token;
|
final Binder dreamToken = mCurrentDream.token;
|
||||||
mHandler.post(wakeLock.wrap(() -> {
|
mHandler.post(wakeLock.wrap(() -> {
|
||||||
mAtmInternal.notifyDreamStateChanged(true);
|
mAtmInternal.notifyActiveDreamChanged(name);
|
||||||
mController.startDream(dreamToken, name, isPreviewMode, canDoze, userId, wakeLock,
|
mController.startDream(dreamToken, name, isPreviewMode, canDoze, userId, wakeLock,
|
||||||
mDreamOverlayServiceName, reason);
|
mDreamOverlayServiceName, reason);
|
||||||
}));
|
}));
|
||||||
@@ -672,7 +668,7 @@ public final class DreamManagerService extends SystemService {
|
|||||||
|
|
||||||
@GuardedBy("mLock")
|
@GuardedBy("mLock")
|
||||||
private void cleanupDreamLocked() {
|
private void cleanupDreamLocked() {
|
||||||
mHandler.post(() -> mAtmInternal.notifyDreamStateChanged(false /*dreaming*/));
|
mHandler.post(() -> mAtmInternal.notifyActiveDreamChanged(null));
|
||||||
|
|
||||||
if (mCurrentDream == null) {
|
if (mCurrentDream == null) {
|
||||||
return;
|
return;
|
||||||
@@ -1012,11 +1008,6 @@ public final class DreamManagerService extends SystemService {
|
|||||||
return canStartDreamingInternal(isScreenOn);
|
return canStartDreamingInternal(isScreenOn);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ComponentName getActiveDreamComponent(boolean doze) {
|
|
||||||
return getActiveDreamComponentInternal(doze);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void requestDream() {
|
public void requestDream() {
|
||||||
requestDreamInternal();
|
requestDreamInternal();
|
||||||
|
|||||||
@@ -287,8 +287,10 @@ public abstract class ActivityTaskManagerInternal {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the device changes its dreaming state.
|
* Called when the device changes its dreaming state.
|
||||||
|
*
|
||||||
|
* @param activeDreamComponent The currently active dream. If null, the device is not dreaming.
|
||||||
*/
|
*/
|
||||||
public abstract void notifyDreamStateChanged(boolean dreaming);
|
public abstract void notifyActiveDreamChanged(@Nullable ComponentName activeDreamComponent);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a uid that is allowed to bypass stopped app switches, launching an app
|
* Set a uid that is allowed to bypass stopped app switches, launching an app
|
||||||
|
|||||||
@@ -208,7 +208,6 @@ import android.os.UserManager;
|
|||||||
import android.os.WorkSource;
|
import android.os.WorkSource;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.service.dreams.DreamActivity;
|
import android.service.dreams.DreamActivity;
|
||||||
import android.service.dreams.DreamManagerInternal;
|
|
||||||
import android.service.voice.IVoiceInteractionSession;
|
import android.service.voice.IVoiceInteractionSession;
|
||||||
import android.service.voice.VoiceInteractionManagerInternal;
|
import android.service.voice.VoiceInteractionManagerInternal;
|
||||||
import android.sysprop.DisplayProperties;
|
import android.sysprop.DisplayProperties;
|
||||||
@@ -669,11 +668,12 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
|
|||||||
private volatile boolean mSleeping;
|
private volatile boolean mSleeping;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The mDreaming state is set by the {@link DreamManagerService} when it receives a request to
|
* The mActiveDreamComponent state is set by the {@link DreamManagerService} when it receives a
|
||||||
* start/stop the dream. It is set to true shortly before the {@link DreamService} is started.
|
* request to start/stop the dream. It is set to the active dream shortly before the
|
||||||
* It is set to false after the {@link DreamService} is stopped.
|
* {@link DreamService} is started. It is set to null after the {@link DreamService} is stopped.
|
||||||
*/
|
*/
|
||||||
private volatile boolean mDreaming;
|
@Nullable
|
||||||
|
private volatile ComponentName mActiveDreamComponent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The process state used for processes that are running the top activities.
|
* The process state used for processes that are running the top activities.
|
||||||
@@ -1442,31 +1442,21 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
|
|||||||
}
|
}
|
||||||
|
|
||||||
boolean isDreaming() {
|
boolean isDreaming() {
|
||||||
return mDreaming;
|
return mActiveDreamComponent != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean canLaunchDreamActivity(String packageName) {
|
boolean canLaunchDreamActivity(String packageName) {
|
||||||
if (!mDreaming || packageName == null) {
|
if (mActiveDreamComponent == null || packageName == null) {
|
||||||
ProtoLog.e(WM_DEBUG_DREAM, "Cannot launch dream activity due to invalid state. "
|
ProtoLog.e(WM_DEBUG_DREAM, "Cannot launch dream activity due to invalid state. "
|
||||||
+ "dreaming: %b packageName: %s", mDreaming, packageName);
|
+ "dream component: %s packageName: %s", mActiveDreamComponent, packageName);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final DreamManagerInternal dreamManager =
|
if (packageName.equals(mActiveDreamComponent.getPackageName())) {
|
||||||
LocalServices.getService(DreamManagerInternal.class);
|
|
||||||
// Verify that the package is the current active dream or doze component. The
|
|
||||||
// getActiveDreamComponent() call path does not acquire the DreamManager lock and thus
|
|
||||||
// is safe to use.
|
|
||||||
final ComponentName activeDream = dreamManager.getActiveDreamComponent(false /* doze */);
|
|
||||||
if (activeDream != null && packageName.equals(activeDream.getPackageName())) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
final ComponentName activeDoze = dreamManager.getActiveDreamComponent(true /* doze */);
|
|
||||||
if (activeDoze != null && packageName.equals(activeDoze.getPackageName())) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
ProtoLog.e(WM_DEBUG_DREAM,
|
ProtoLog.e(WM_DEBUG_DREAM,
|
||||||
"Dream packageName does not match active dream. Package %s does not match %s or %s",
|
"Dream packageName does not match active dream. Package %s does not match %s",
|
||||||
packageName, String.valueOf(activeDream), String.valueOf(activeDoze));
|
packageName, String.valueOf(mActiveDreamComponent));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5685,9 +5675,9 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void notifyDreamStateChanged(boolean dreaming) {
|
public void notifyActiveDreamChanged(@Nullable ComponentName dreamComponent) {
|
||||||
synchronized (mGlobalLock) {
|
synchronized (mGlobalLock) {
|
||||||
mDreaming = dreaming;
|
mActiveDreamComponent = dreamComponent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user