Register rule for wallpaper entry

We should keep consistent split rule for wallpaper and other home menu
item. So, we create this cl to register the split rule for wallpaper.

Also, I do some minor refactoring in this cl for reusing existing
method and better code quality.

Test: Go to wallpaper, and click back key. App can close.
Fix: 204406425
Fix: 204364572

Change-Id: Ia7de9483b351d1121cc26c4af1cb8a89ad0a16bc
This commit is contained in:
Tsung-Mao Fang
2021-11-03 16:27:30 +08:00
parent 8118b9ff29
commit b3db40a02b
5 changed files with 47 additions and 15 deletions

View File

@@ -31,6 +31,7 @@ import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import com.android.settings.activityembedding.ActivityEmbeddingRulesController;
import com.android.settings.activityembedding.ActivityEmbeddingUtils;
import com.android.settings.core.BasePreferenceController;
import com.android.settingslib.RestrictedLockUtilsInternal;
@@ -102,6 +103,11 @@ public class TopLevelWallpaperPreferenceController extends BasePreferenceControl
mContext)) {
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
}
ActivityEmbeddingRulesController.registerTwoPanePairRuleForSettingsHome(
mContext,
intent.getComponent(),
null /* secondaryIntentAction */,
true /* clearTop */);
preference.getContext().startActivity(intent);
return true;
}