Merge "Improved UX when no debuggable apps are available." into rvc-dev am: 6217af3fe1
am: 5b5c335b01
am: 74a89fb9fd
am: 01d0ea7443
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/11675592 Change-Id: Iadd7046da7869a864db428f78a122a250d8f98c3
This commit is contained in:
@@ -11345,6 +11345,10 @@
|
|||||||
<string name="platform_compat_default_disabled_title">Default disabled changes</string>
|
<string name="platform_compat_default_disabled_title">Default disabled changes</string>
|
||||||
<!-- Title for target SDK gated app compat changes category (do not translate 'targetSdkVersion') [CHAR LIMIT=50] -->
|
<!-- Title for target SDK gated app compat changes category (do not translate 'targetSdkVersion') [CHAR LIMIT=50] -->
|
||||||
<string name="platform_compat_target_sdk_title">Enabled for targetSdkVersion > <xliff:g id="number" example="29">%d</xliff:g></string>
|
<string name="platform_compat_target_sdk_title">Enabled for targetSdkVersion > <xliff:g id="number" example="29">%d</xliff:g></string>
|
||||||
|
<!-- Title for the dialog shown when no debuggable apps are available [CHAR LIMIT=20] -->
|
||||||
|
<string name="platform_compat_dialog_title_no_apps">No apps available</string>
|
||||||
|
<!-- Explanatory text shown when no debuggable apps are available [CHAR LIMIT=NONE] -->
|
||||||
|
<string name="platform_compat_dialog_text_no_apps">App compatibility changes can only be modified for debuggable apps. Install a debuggable app and try again.</string>
|
||||||
|
|
||||||
<!-- Slices Strings -->
|
<!-- Slices Strings -->
|
||||||
|
|
||||||
|
@@ -47,10 +47,14 @@ public class AppPicker extends ListActivity {
|
|||||||
= "com.android.settings.extra.REQUESTIING_PERMISSION";
|
= "com.android.settings.extra.REQUESTIING_PERMISSION";
|
||||||
public static final String EXTRA_DEBUGGABLE = "com.android.settings.extra.DEBUGGABLE";
|
public static final String EXTRA_DEBUGGABLE = "com.android.settings.extra.DEBUGGABLE";
|
||||||
public static final String EXTRA_NON_SYSTEM = "com.android.settings.extra.NON_SYSTEM";
|
public static final String EXTRA_NON_SYSTEM = "com.android.settings.extra.NON_SYSTEM";
|
||||||
|
public static final String EXTRA_INCLUDE_NOTHING = "com.android.settings.extra.INCLUDE_NOTHING";
|
||||||
|
|
||||||
|
public static final int RESULT_NO_MATCHING_APPS = -2;
|
||||||
|
|
||||||
private String mPermissionName;
|
private String mPermissionName;
|
||||||
private boolean mDebuggableOnly;
|
private boolean mDebuggableOnly;
|
||||||
private boolean mNonSystemOnly;
|
private boolean mNonSystemOnly;
|
||||||
|
private boolean mIncludeNothing;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle icicle) {
|
protected void onCreate(Bundle icicle) {
|
||||||
@@ -60,9 +64,11 @@ public class AppPicker extends ListActivity {
|
|||||||
mPermissionName = getIntent().getStringExtra(EXTRA_REQUESTIING_PERMISSION);
|
mPermissionName = getIntent().getStringExtra(EXTRA_REQUESTIING_PERMISSION);
|
||||||
mDebuggableOnly = getIntent().getBooleanExtra(EXTRA_DEBUGGABLE, false);
|
mDebuggableOnly = getIntent().getBooleanExtra(EXTRA_DEBUGGABLE, false);
|
||||||
mNonSystemOnly = getIntent().getBooleanExtra(EXTRA_NON_SYSTEM, false);
|
mNonSystemOnly = getIntent().getBooleanExtra(EXTRA_NON_SYSTEM, false);
|
||||||
|
mIncludeNothing = getIntent().getBooleanExtra(EXTRA_INCLUDE_NOTHING, true);
|
||||||
|
|
||||||
mAdapter = new AppListAdapter(this);
|
mAdapter = new AppListAdapter(this);
|
||||||
if (mAdapter.getCount() <= 0) {
|
if (mAdapter.getCount() <= 0) {
|
||||||
|
setResult(RESULT_NO_MATCHING_APPS);
|
||||||
finish();
|
finish();
|
||||||
} else {
|
} else {
|
||||||
setListAdapter(mAdapter);
|
setListAdapter(mAdapter);
|
||||||
@@ -160,9 +166,11 @@ public class AppPicker extends ListActivity {
|
|||||||
mPackageInfoList.add(info);
|
mPackageInfoList.add(info);
|
||||||
}
|
}
|
||||||
Collections.sort(mPackageInfoList, sDisplayNameComparator);
|
Collections.sort(mPackageInfoList, sDisplayNameComparator);
|
||||||
MyApplicationInfo info = new MyApplicationInfo();
|
if (mIncludeNothing) {
|
||||||
info.label = context.getText(R.string.no_application);
|
MyApplicationInfo info = new MyApplicationInfo();
|
||||||
mPackageInfoList.add(0, info);
|
info.label = context.getText(R.string.no_application);
|
||||||
|
mPackageInfoList.add(0, info);
|
||||||
|
}
|
||||||
addAll(mPackageInfoList);
|
addAll(mPackageInfoList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -20,6 +20,7 @@ import static com.android.internal.compat.OverrideAllowedState.ALLOWED;
|
|||||||
import static com.android.settings.development.DevelopmentOptionsActivityRequestCodes.REQUEST_COMPAT_CHANGE_APP;
|
import static com.android.settings.development.DevelopmentOptionsActivityRequestCodes.REQUEST_COMPAT_CHANGE_APP;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.app.AlertDialog;
|
||||||
import android.app.settings.SettingsEnums;
|
import android.app.settings.SettingsEnums;
|
||||||
import android.compat.Compatibility.ChangeConfig;
|
import android.compat.Compatibility.ChangeConfig;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -124,6 +125,14 @@ public class PlatformCompatDashboard extends DashboardFragment {
|
|||||||
} catch (PackageManager.NameNotFoundException e) {
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
startAppPicker();
|
startAppPicker();
|
||||||
}
|
}
|
||||||
|
} else if (resultCode == AppPicker.RESULT_NO_MATCHING_APPS) {
|
||||||
|
new AlertDialog.Builder(getContext())
|
||||||
|
.setTitle(R.string.platform_compat_dialog_title_no_apps)
|
||||||
|
.setMessage(R.string.platform_compat_dialog_text_no_apps)
|
||||||
|
.setPositiveButton(R.string.okay, (dialog, which) -> finish())
|
||||||
|
.setOnDismissListener(dialog -> finish())
|
||||||
|
.setCancelable(false)
|
||||||
|
.show();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -254,7 +263,8 @@ public class PlatformCompatDashboard extends DashboardFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void startAppPicker() {
|
private void startAppPicker() {
|
||||||
final Intent intent = new Intent(getContext(), AppPicker.class);
|
final Intent intent = new Intent(getContext(), AppPicker.class)
|
||||||
|
.putExtra(AppPicker.EXTRA_INCLUDE_NOTHING, false);
|
||||||
// If build is neither userdebug nor eng, only include debuggable apps
|
// If build is neither userdebug nor eng, only include debuggable apps
|
||||||
final boolean debuggableBuild = mAndroidBuildClassifier.isDebuggableBuild();
|
final boolean debuggableBuild = mAndroidBuildClassifier.isDebuggableBuild();
|
||||||
if (!debuggableBuild) {
|
if (!debuggableBuild) {
|
||||||
|
Reference in New Issue
Block a user