Add Open button to launch instant app.

- move logic from InstantAppButtonsController into
InstantAppButtonsPreferenceController, as it is not really necessary to
have separate control to be in different class.
- add logic to check if the instant app provides a default launch uri.
If so, show a Open button to launch the uri, and move the Install
button into option menu. If not, Install button remains as is.
- also update the instant app button layout to match the regular 2
buttons layout.

Change-Id: Ibcae780ad697ca93a48604b03c8f4600dd3c0472
Fixes: 69562807
Test: make RunSettingsRoboTests
This commit is contained in:
Doris Ling
2018-02-20 13:36:40 -08:00
parent c85e701b3d
commit f9ab8ea7bd
8 changed files with 350 additions and 381 deletions

View File

@@ -85,6 +85,7 @@ public class AppInfoDashboardFragment extends DashboardFragment
@VisibleForTesting static final int UNINSTALL_ALL_USERS_MENU = 1;
@VisibleForTesting static final int UNINSTALL_UPDATES = 2;
static final int FORCE_STOP_MENU = 3;
static final int INSTALL_INSTANT_APP_MENU = 4;
// Result code identifiers
@VisibleForTesting
@@ -102,6 +103,7 @@ public class AppInfoDashboardFragment extends DashboardFragment
static final int DLG_FORCE_STOP = DLG_BASE + 1;
private static final int DLG_DISABLE = DLG_BASE + 2;
private static final int DLG_SPECIAL_DISABLE = DLG_BASE + 3;
static final int DLG_CLEAR_INSTANT_APP = DLG_BASE + 4;
private static final String KEY_ADVANCED_APP_INFO_CATEGORY = "advanced_app_info";
@@ -243,7 +245,7 @@ public class AppInfoDashboardFragment extends DashboardFragment
// The following are controllers for preferences that don't need to refresh the preference
// state when app state changes.
mInstantAppButtonPreferenceController =
new InstantAppButtonsPreferenceController(context, this, packageName);
new InstantAppButtonsPreferenceController(context, this, packageName, lifecycle);
controllers.add(mInstantAppButtonPreferenceController);
controllers.add(new AppBatteryPreferenceController(context, this, packageName, lifecycle));
controllers.add(new AppMemoryPreferenceController(context, this, lifecycle));