Loading core/java/android/service/dreams/DreamActivity.java +3 −2 Original line number Diff line number Diff line Loading @@ -58,8 +58,9 @@ public class DreamActivity extends Activity { setTitle(title); } DreamService.DreamServiceWrapper callback = (DreamService.DreamServiceWrapper) getIntent().getIBinderExtra(EXTRA_CALLBACK); final Bundle extras = getIntent().getExtras(); final DreamService.DreamActivityCallback callback = (DreamService.DreamActivityCallback) extras.getBinder(EXTRA_CALLBACK); if (callback != null) { callback.onActivityCreated(this); Loading core/java/android/service/dreams/DreamService.java +31 −5 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ import android.content.pm.ServiceInfo; import android.content.res.TypedArray; import android.content.res.XmlResourceParser; import android.graphics.drawable.Drawable; import android.os.Binder; import android.os.Build; import android.os.Handler; import android.os.IBinder; Loading Loading @@ -1272,7 +1273,7 @@ public class DreamService extends Service implements Window.Callback { Intent i = new Intent(this, DreamActivity.class); i.setPackage(getApplicationContext().getPackageName()); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); i.putExtra(DreamActivity.EXTRA_CALLBACK, mDreamServiceWrapper); i.putExtra(DreamActivity.EXTRA_CALLBACK, new DreamActivityCallback(mDreamToken)); final ServiceInfo serviceInfo = fetchServiceInfo(this, new ComponentName(this, getClass())); i.putExtra(DreamActivity.EXTRA_DREAM_TITLE, fetchDreamLabel(this, serviceInfo)); Loading Loading @@ -1452,11 +1453,36 @@ public class DreamService extends Service implements Window.Callback { public void wakeUp() { mHandler.post(() -> DreamService.this.wakeUp(true /*fromSystem*/)); } } /** @hide */ void onActivityCreated(DreamActivity a) { mActivity = a; onWindowCreated(a.getWindow()); final class DreamActivityCallback extends Binder { private final IBinder mActivityDreamToken; DreamActivityCallback(IBinder token) { mActivityDreamToken = token; } void onActivityCreated(DreamActivity activity) { if (mActivityDreamToken != mDreamToken || mFinished) { Slog.d(TAG, "DreamActivity was created after the dream was finished or " + "a new dream started, finishing DreamActivity"); if (!activity.isFinishing()) { activity.finishAndRemoveTask(); } return; } if (mActivity != null) { Slog.w(TAG, "A DreamActivity has already been started, " + "finishing latest DreamActivity"); if (!activity.isFinishing()) { activity.finishAndRemoveTask(); } return; } mActivity = activity; onWindowCreated(activity.getWindow()); } } Loading libs/WindowManager/Shell/res/values/strings_tv.xml +19 −4 Original line number Diff line number Diff line Loading @@ -26,23 +26,38 @@ <!-- Picture-in-Picture (PIP) menu --> <eat-comment /> <!-- Button to close picture-in-picture (PIP) in PIP menu [CHAR LIMIT=30] --> <string name="pip_close">Close PIP</string> <string name="pip_close">Close</string> <!-- Button to move picture-in-picture (PIP) screen to the fullscreen in PIP menu [CHAR LIMIT=30] --> <string name="pip_fullscreen">Full screen</string> <!-- Button to move picture-in-picture (PIP) via DPAD in the PIP menu [CHAR LIMIT=30] --> <string name="pip_move">Move PIP</string> <string name="pip_move">Move</string> <!-- Button to expand the picture-in-picture (PIP) window [CHAR LIMIT=30] --> <string name="pip_expand">Expand PIP</string> <string name="pip_expand">Expand</string> <!-- Button to collapse/shrink the picture-in-picture (PIP) window [CHAR LIMIT=30] --> <string name="pip_collapse">Collapse PIP</string> <string name="pip_collapse">Collapse</string> <!-- Educative text instructing the user to double press the HOME button to access the pip controls menu [CHAR LIMIT=50] --> <string name="pip_edu_text"> Double press <annotation icon="home_icon"> HOME </annotation> for controls </string> <!-- Accessibility announcement when opening the PiP menu. [CHAR LIMIT=NONE] --> <string name="a11y_pip_menu_entered">Picture-in-Picture menu.</string> <!-- Accessibility action: move the PiP window to the left [CHAR LIMIT=30] --> <string name="a11y_action_pip_move_left">Move left</string> <!-- Accessibility action: move the PiP window to the right [CHAR LIMIT=30] --> <string name="a11y_action_pip_move_right">Move right</string> <!-- Accessibility action: move the PiP window up [CHAR LIMIT=30] --> <string name="a11y_action_pip_move_up">Move up</string> <!-- Accessibility action: move the PiP window down [CHAR LIMIT=30] --> <string name="a11y_action_pip_move_down">Move down</string> <!-- Accessibility action: done with moving the PiP [CHAR LIMIT=30] --> <string name="a11y_action_pip_move_done">Done</string> </resources> Loading
core/java/android/service/dreams/DreamActivity.java +3 −2 Original line number Diff line number Diff line Loading @@ -58,8 +58,9 @@ public class DreamActivity extends Activity { setTitle(title); } DreamService.DreamServiceWrapper callback = (DreamService.DreamServiceWrapper) getIntent().getIBinderExtra(EXTRA_CALLBACK); final Bundle extras = getIntent().getExtras(); final DreamService.DreamActivityCallback callback = (DreamService.DreamActivityCallback) extras.getBinder(EXTRA_CALLBACK); if (callback != null) { callback.onActivityCreated(this); Loading
core/java/android/service/dreams/DreamService.java +31 −5 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ import android.content.pm.ServiceInfo; import android.content.res.TypedArray; import android.content.res.XmlResourceParser; import android.graphics.drawable.Drawable; import android.os.Binder; import android.os.Build; import android.os.Handler; import android.os.IBinder; Loading Loading @@ -1272,7 +1273,7 @@ public class DreamService extends Service implements Window.Callback { Intent i = new Intent(this, DreamActivity.class); i.setPackage(getApplicationContext().getPackageName()); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); i.putExtra(DreamActivity.EXTRA_CALLBACK, mDreamServiceWrapper); i.putExtra(DreamActivity.EXTRA_CALLBACK, new DreamActivityCallback(mDreamToken)); final ServiceInfo serviceInfo = fetchServiceInfo(this, new ComponentName(this, getClass())); i.putExtra(DreamActivity.EXTRA_DREAM_TITLE, fetchDreamLabel(this, serviceInfo)); Loading Loading @@ -1452,11 +1453,36 @@ public class DreamService extends Service implements Window.Callback { public void wakeUp() { mHandler.post(() -> DreamService.this.wakeUp(true /*fromSystem*/)); } } /** @hide */ void onActivityCreated(DreamActivity a) { mActivity = a; onWindowCreated(a.getWindow()); final class DreamActivityCallback extends Binder { private final IBinder mActivityDreamToken; DreamActivityCallback(IBinder token) { mActivityDreamToken = token; } void onActivityCreated(DreamActivity activity) { if (mActivityDreamToken != mDreamToken || mFinished) { Slog.d(TAG, "DreamActivity was created after the dream was finished or " + "a new dream started, finishing DreamActivity"); if (!activity.isFinishing()) { activity.finishAndRemoveTask(); } return; } if (mActivity != null) { Slog.w(TAG, "A DreamActivity has already been started, " + "finishing latest DreamActivity"); if (!activity.isFinishing()) { activity.finishAndRemoveTask(); } return; } mActivity = activity; onWindowCreated(activity.getWindow()); } } Loading
libs/WindowManager/Shell/res/values/strings_tv.xml +19 −4 Original line number Diff line number Diff line Loading @@ -26,23 +26,38 @@ <!-- Picture-in-Picture (PIP) menu --> <eat-comment /> <!-- Button to close picture-in-picture (PIP) in PIP menu [CHAR LIMIT=30] --> <string name="pip_close">Close PIP</string> <string name="pip_close">Close</string> <!-- Button to move picture-in-picture (PIP) screen to the fullscreen in PIP menu [CHAR LIMIT=30] --> <string name="pip_fullscreen">Full screen</string> <!-- Button to move picture-in-picture (PIP) via DPAD in the PIP menu [CHAR LIMIT=30] --> <string name="pip_move">Move PIP</string> <string name="pip_move">Move</string> <!-- Button to expand the picture-in-picture (PIP) window [CHAR LIMIT=30] --> <string name="pip_expand">Expand PIP</string> <string name="pip_expand">Expand</string> <!-- Button to collapse/shrink the picture-in-picture (PIP) window [CHAR LIMIT=30] --> <string name="pip_collapse">Collapse PIP</string> <string name="pip_collapse">Collapse</string> <!-- Educative text instructing the user to double press the HOME button to access the pip controls menu [CHAR LIMIT=50] --> <string name="pip_edu_text"> Double press <annotation icon="home_icon"> HOME </annotation> for controls </string> <!-- Accessibility announcement when opening the PiP menu. [CHAR LIMIT=NONE] --> <string name="a11y_pip_menu_entered">Picture-in-Picture menu.</string> <!-- Accessibility action: move the PiP window to the left [CHAR LIMIT=30] --> <string name="a11y_action_pip_move_left">Move left</string> <!-- Accessibility action: move the PiP window to the right [CHAR LIMIT=30] --> <string name="a11y_action_pip_move_right">Move right</string> <!-- Accessibility action: move the PiP window up [CHAR LIMIT=30] --> <string name="a11y_action_pip_move_up">Move up</string> <!-- Accessibility action: move the PiP window down [CHAR LIMIT=30] --> <string name="a11y_action_pip_move_down">Move down</string> <!-- Accessibility action: done with moving the PiP [CHAR LIMIT=30] --> <string name="a11y_action_pip_move_done">Done</string> </resources>