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

This commit is contained in:
TreeHugger Robot
2022-04-14 23:14:39 +00:00
committed by Android (Google) Code Review
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.app.Activity;
import android.os.Bundle;
import android.text.TextUtils;
import com.android.internal.R;
@@ -44,6 +45,7 @@ import com.android.internal.R;
*/
public class DreamActivity extends Activity {
static final String EXTRA_CALLBACK = "binder";
static final String EXTRA_DREAM_TITLE = "title";
public DreamActivity() {}
@@ -51,6 +53,11 @@ public class DreamActivity extends Activity {
public void onCreate(@Nullable Bundle bundle) {
super.onCreate(bundle);
final String title = getIntent().getStringExtra(EXTRA_DREAM_TITLE);
if (!TextUtils.isEmpty(title)) {
setTitle(title);
}
DreamService.DreamServiceWrapper 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.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
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 {
if (!ActivityTaskManager.getService().startDreamActivity(i)) {