[Activity embedding] Fix unexpected finished 2nd layer problem
If Settings is started on an existing task, the existing SplitPairRule may cause an unexpected app finish while navigating back from the 2nd layer page. This change resets SplitPairRule in onNewIntent(). Bug: 247080168 Test: make RunSettingsRoboTests ROBOTEST_FILTER=SettingsHomepageActivityTest manual 1. Settings app -> 'Connexted device'. 2. Launch Settings app again from Settings icon in quick Settings. 3. Start a 3rd layer from 'Network & internet' 4. Click back and see if the 2nd lay shows. Change-Id: I262327cc49c3a4434a183eb00ac57f47fa598f70 Merged-In: I262327cc49c3a4434a183eb00ac57f47fa598f70
This commit is contained in:
@@ -43,6 +43,7 @@ import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.Toolbar;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowCompat;
|
||||
@@ -242,10 +243,21 @@ public class SettingsHomepageActivity extends FragmentActivity implements
|
||||
if (isFinishing()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ActivityEmbeddingUtils.isEmbeddingActivityEnabled(this)
|
||||
&& (intent.getFlags() & Intent.FLAG_ACTIVITY_CLEAR_TOP) != 0) {
|
||||
initSplitPairRules();
|
||||
}
|
||||
|
||||
// Launch the intent from deep link for large screen devices.
|
||||
launchDeepLinkIntentToRight();
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
void initSplitPairRules() {
|
||||
new ActivityEmbeddingRulesController(getApplicationContext()).initRules();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
@@ -502,7 +514,8 @@ public class SettingsHomepageActivity extends FragmentActivity implements
|
||||
return menuKey;
|
||||
}
|
||||
|
||||
private void reloadHighlightMenuKey() {
|
||||
@VisibleForTesting
|
||||
void reloadHighlightMenuKey() {
|
||||
mMainFragment.getArguments().putString(SettingsActivity.EXTRA_FRAGMENT_ARG_KEY,
|
||||
getHighlightMenuKey());
|
||||
mMainFragment.reloadHighlightMenuKey();
|
||||
|
Reference in New Issue
Block a user