Support another new intent for mainline module intent
Mainline module team would like to create a new intent to support v2 UX. In Settings side, if we found system supports this intent, then we should navigate user to new place. Test: Run robo test Fix: 151189987 Change-Id: If4b437236b70c83a1f29a5c3d9e322178c8a6ec6
This commit is contained in:
@@ -47,6 +47,10 @@ public class MainlineModuleVersionPreferenceController extends BasePreferenceCon
|
||||
@VisibleForTesting
|
||||
static final Intent MODULE_UPDATE_INTENT =
|
||||
new Intent("android.settings.MODULE_UPDATE_SETTINGS");
|
||||
@VisibleForTesting
|
||||
static final Intent MODULE_UPDATE_V2_INTENT =
|
||||
new Intent("android.settings.MODULE_UPDATE_VERSIONS");
|
||||
|
||||
private final PackageManager mPackageManager;
|
||||
|
||||
private String mModuleVersion;
|
||||
@@ -81,7 +85,14 @@ public class MainlineModuleVersionPreferenceController extends BasePreferenceCon
|
||||
public void updateState(Preference preference) {
|
||||
super.updateState(preference);
|
||||
|
||||
// Confirm MODULE_UPDATE_INTENT is handleable, and set it to Preference.
|
||||
final ResolveInfo resolvedV2 =
|
||||
mPackageManager.resolveActivity(MODULE_UPDATE_V2_INTENT, 0 /* flags */);
|
||||
if (resolvedV2 != null) {
|
||||
preference.setIntent(MODULE_UPDATE_V2_INTENT);
|
||||
preference.setSelectable(true);
|
||||
return;
|
||||
}
|
||||
|
||||
final ResolveInfo resolved =
|
||||
mPackageManager.resolveActivity(MODULE_UPDATE_INTENT, 0 /* flags */);
|
||||
if (resolved != null) {
|
||||
|
Reference in New Issue
Block a user