Merge changes Id71b4cbc,I8dff0a12,Ife3d1390 into rvc-dev am: a72d7e53e6 am: 183986e0a9
Change-Id: I491a1358c81827b4dfacaf065bcbd0fa47ee418b
This commit is contained in:
@@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
package android.service.dreams;
|
package android.service.dreams;
|
||||||
|
|
||||||
|
import android.content.ComponentName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dream manager local system service interface.
|
* Dream manager local system service interface.
|
||||||
*
|
*
|
||||||
@@ -42,4 +44,13 @@ public abstract class DreamManagerInternal {
|
|||||||
* Called by the power manager to determine whether a dream is running.
|
* Called by the power manager to determine whether a dream is running.
|
||||||
*/
|
*/
|
||||||
public abstract boolean isDreaming();
|
public abstract boolean isDreaming();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called by the ActivityTaskManagerService to verify that the startDreamActivity
|
||||||
|
* request comes from the current active dream component.
|
||||||
|
*
|
||||||
|
* @param doze If true returns the current active doze component. Otherwise, returns the
|
||||||
|
* active dream component.
|
||||||
|
*/
|
||||||
|
public abstract ComponentName getActiveDreamComponent(boolean doze);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -608,6 +608,8 @@ public class DreamService extends Service implements Window.Callback {
|
|||||||
* Marks this dream as windowless. Only available to doze dreams.
|
* Marks this dream as windowless. Only available to doze dreams.
|
||||||
*
|
*
|
||||||
* @hide
|
* @hide
|
||||||
|
*
|
||||||
|
* TODO: Remove @UnsupportedAppUsage.
|
||||||
*/
|
*/
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
public void setWindowless(boolean windowless) {
|
public void setWindowless(boolean windowless) {
|
||||||
@@ -904,12 +906,9 @@ public class DreamService extends Service implements Window.Callback {
|
|||||||
|
|
||||||
if (mActivity == null) {
|
if (mActivity == null) {
|
||||||
Slog.w(TAG, "Finish was called before the dream was attached.");
|
Slog.w(TAG, "Finish was called before the dream was attached.");
|
||||||
return;
|
} else if (!mActivity.isFinishing()) {
|
||||||
}
|
// In case the activity is not finished yet, do it now. This can happen if someone calls
|
||||||
|
// finish() directly, without going through wakeUp().
|
||||||
// In case the activity is not finished yet, do it now. This can happen if someone calls
|
|
||||||
// finish() directly, without going through wakeUp().
|
|
||||||
if (!mActivity.isFinishing()) {
|
|
||||||
mActivity.finishAndRemoveTask();
|
mActivity.finishAndRemoveTask();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -924,7 +923,6 @@ public class DreamService extends Service implements Window.Callback {
|
|||||||
} catch (RemoteException ex) {
|
} catch (RemoteException ex) {
|
||||||
// system server died
|
// system server died
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -995,6 +993,8 @@ public class DreamService extends Service implements Window.Callback {
|
|||||||
|
|
||||||
if (mActivity != null && !mActivity.isFinishing()) {
|
if (mActivity != null && !mActivity.isFinishing()) {
|
||||||
mActivity.finishAndRemoveTask();
|
mActivity.finishAndRemoveTask();
|
||||||
|
} else {
|
||||||
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
mDreamToken = null;
|
mDreamToken = null;
|
||||||
|
|||||||
@@ -268,6 +268,10 @@ public final class DreamManagerService extends SystemService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ComponentName getActiveDreamComponentInternal(boolean doze) {
|
||||||
|
return chooseDreamForUser(doze, ActivityManager.getCurrentUser());
|
||||||
|
}
|
||||||
|
|
||||||
private ComponentName chooseDreamForUser(boolean doze, int userId) {
|
private ComponentName chooseDreamForUser(boolean doze, int userId) {
|
||||||
if (doze) {
|
if (doze) {
|
||||||
ComponentName dozeComponent = getDozeComponent(userId);
|
ComponentName dozeComponent = getDozeComponent(userId);
|
||||||
@@ -671,6 +675,11 @@ public final class DreamManagerService extends SystemService {
|
|||||||
public boolean isDreaming() {
|
public boolean isDreaming() {
|
||||||
return isDreamingInternal();
|
return isDreamingInternal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ComponentName getActiveDreamComponent(boolean doze) {
|
||||||
|
return getActiveDreamComponentInternal(doze);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final Runnable mSystemPropertiesChanged = new Runnable() {
|
private final Runnable mSystemPropertiesChanged = new Runnable() {
|
||||||
|
|||||||
@@ -213,6 +213,7 @@ import android.os.storage.IStorageManager;
|
|||||||
import android.os.storage.StorageManager;
|
import android.os.storage.StorageManager;
|
||||||
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;
|
||||||
@@ -1233,12 +1234,25 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean startDreamActivity(Intent intent) {
|
public boolean startDreamActivity(Intent intent) {
|
||||||
|
final WindowProcessController process = mProcessMap.getProcess(Binder.getCallingPid());
|
||||||
|
final long origId = Binder.clearCallingIdentity();
|
||||||
|
|
||||||
|
// The dream activity is only called for non-doze dreams.
|
||||||
|
final ComponentName currentDream = LocalServices.getService(DreamManagerInternal.class)
|
||||||
|
.getActiveDreamComponent(/* doze= */ false);
|
||||||
|
|
||||||
|
if (currentDream == null || currentDream.getPackageName() == null
|
||||||
|
|| !currentDream.getPackageName().equals(process.mInfo.packageName)) {
|
||||||
|
Slog.e(TAG, "Calling package is not the current dream package. "
|
||||||
|
+ "Aborting startDreamActivity...");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
final ActivityInfo a = new ActivityInfo();
|
final ActivityInfo a = new ActivityInfo();
|
||||||
a.theme = com.android.internal.R.style.Theme_Dream;
|
a.theme = com.android.internal.R.style.Theme_Dream;
|
||||||
a.exported = true;
|
a.exported = true;
|
||||||
a.name = DreamActivity.class.getName();
|
a.name = DreamActivity.class.getName();
|
||||||
|
|
||||||
final WindowProcessController process = mProcessMap.getProcess(Binder.getCallingPid());
|
|
||||||
|
|
||||||
a.packageName = process.mInfo.packageName;
|
a.packageName = process.mInfo.packageName;
|
||||||
a.applicationInfo = process.mInfo;
|
a.applicationInfo = process.mInfo;
|
||||||
@@ -1253,7 +1267,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
|
|||||||
a.colorMode = ActivityInfo.COLOR_MODE_DEFAULT;
|
a.colorMode = ActivityInfo.COLOR_MODE_DEFAULT;
|
||||||
a.flags |= ActivityInfo.FLAG_EXCLUDE_FROM_RECENTS;
|
a.flags |= ActivityInfo.FLAG_EXCLUDE_FROM_RECENTS;
|
||||||
|
|
||||||
final long origId = Binder.clearCallingIdentity();
|
|
||||||
try {
|
try {
|
||||||
getActivityStartController().obtainStarter(intent, "dream")
|
getActivityStartController().obtainStarter(intent, "dream")
|
||||||
.setActivityInfo(a)
|
.setActivityInfo(a)
|
||||||
|
|||||||
Reference in New Issue
Block a user