Merge "Accessibility: Set the title of the dream activity to the label of the current dream." into tm-dev am: 13f4c58deb

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17756695

Change-Id: I3f02d6b9cde515d3828edd1e4c17ad5a03fb0817
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
TreeHugger Robot
2022-04-14 23:29:04 +00:00
committed by Automerger Merge Worker
2 changed files with 10 additions and 0 deletions

View File

@@ -19,6 +19,7 @@ package android.service.dreams;
import android.annotation.Nullable; import android.annotation.Nullable;
import android.app.Activity; import android.app.Activity;
import android.os.Bundle; import android.os.Bundle;
import android.text.TextUtils;
import com.android.internal.R; import com.android.internal.R;
@@ -44,6 +45,7 @@ import com.android.internal.R;
*/ */
public class DreamActivity extends Activity { public class DreamActivity extends Activity {
static final String EXTRA_CALLBACK = "binder"; static final String EXTRA_CALLBACK = "binder";
static final String EXTRA_DREAM_TITLE = "title";
public DreamActivity() {} public DreamActivity() {}
@@ -51,6 +53,11 @@ public class DreamActivity extends Activity {
public void onCreate(@Nullable Bundle bundle) { public void onCreate(@Nullable Bundle bundle) {
super.onCreate(bundle); super.onCreate(bundle);
final String title = getIntent().getStringExtra(EXTRA_DREAM_TITLE);
if (!TextUtils.isEmpty(title)) {
setTitle(title);
}
DreamService.DreamServiceWrapper callback = DreamService.DreamServiceWrapper callback =
(DreamService.DreamServiceWrapper) getIntent().getIBinderExtra(EXTRA_CALLBACK); (DreamService.DreamServiceWrapper) getIntent().getIBinderExtra(EXTRA_CALLBACK);

View File

@@ -1280,6 +1280,9 @@ public class DreamService extends Service implements Window.Callback {
i.setPackage(getApplicationContext().getPackageName()); i.setPackage(getApplicationContext().getPackageName());
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
i.putExtra(DreamActivity.EXTRA_CALLBACK, mDreamServiceWrapper); i.putExtra(DreamActivity.EXTRA_CALLBACK, mDreamServiceWrapper);
final ServiceInfo serviceInfo = fetchServiceInfo(this,
new ComponentName(this, getClass()));
i.putExtra(DreamActivity.EXTRA_DREAM_TITLE, fetchDreamLabel(this, serviceInfo));
try { try {
if (!ActivityTaskManager.getService().startDreamActivity(i)) { if (!ActivityTaskManager.getService().startDreamActivity(i)) {