Finish HomepageActivity when it's not the root of a task and not singleTask.
HomepageActivity should be the first activity in a task, or be launched in singleTask mode. Finishing it will bring up the previous activity in the task. Fix: 297857732 Test: robotest Change-Id: Iddcba1652060d755693dd20d0e350e3d6c1ae138
This commit is contained in:
@@ -183,6 +183,12 @@ public class SettingsHomepageActivity extends FragmentActivity implements
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
if (!isTaskRoot() && !isSingleTask()) {
|
||||
Log.i(TAG, "Not task root nor single task, finish");
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
mIsEmbeddingActivityEnabled = ActivityEmbeddingUtils.isEmbeddingActivityEnabled(this);
|
||||
if (mIsEmbeddingActivityEnabled) {
|
||||
final UserManager um = getSystemService(UserManager.class);
|
||||
@@ -308,6 +314,12 @@ public class SettingsHomepageActivity extends FragmentActivity implements
|
||||
updateHomepageUI();
|
||||
}
|
||||
|
||||
private boolean isSingleTask() {
|
||||
ActivityInfo info = getIntent().resolveActivityInfo(getPackageManager(),
|
||||
PackageManager.MATCH_DEFAULT_ONLY);
|
||||
return info.launchMode == ActivityInfo.LAUNCH_SINGLE_TASK;
|
||||
}
|
||||
|
||||
private void updateSplitLayout() {
|
||||
if (!mIsEmbeddingActivityEnabled) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user