Merge "Fix app link open mode UI"
This commit is contained in:
committed by
Android (Google) Code Review
commit
5fce5f498a
@@ -124,6 +124,8 @@ public class AppLaunchSettings extends AppInfoWithHeader implements OnClickListe
|
|||||||
// * always
|
// * always
|
||||||
// * ask
|
// * ask
|
||||||
// * never
|
// * never
|
||||||
|
//
|
||||||
|
// Make sure to update linkStateToIndex() if this presentation order is changed.
|
||||||
mAppLinkState.setEntries(new CharSequence[] {
|
mAppLinkState.setEntries(new CharSequence[] {
|
||||||
getString(R.string.app_link_open_always),
|
getString(R.string.app_link_open_always),
|
||||||
getString(R.string.app_link_open_ask),
|
getString(R.string.app_link_open_ask),
|
||||||
@@ -141,10 +143,7 @@ public class AppLaunchSettings extends AppInfoWithHeader implements OnClickListe
|
|||||||
// purposes of the UI (and does the right thing around pending domain
|
// purposes of the UI (and does the right thing around pending domain
|
||||||
// verifications that might arrive after the user chooses 'ask' in this UI).
|
// verifications that might arrive after the user chooses 'ask' in this UI).
|
||||||
final int state = mPm.getIntentVerificationStatusAsUser(mPackageName, UserHandle.myUserId());
|
final int state = mPm.getIntentVerificationStatusAsUser(mPackageName, UserHandle.myUserId());
|
||||||
mAppLinkState.setValue(
|
mAppLinkState.setValueIndex(linkStateToIndex(state));
|
||||||
Integer.toString((state == INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED)
|
|
||||||
? INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS_ASK
|
|
||||||
: state));
|
|
||||||
|
|
||||||
// Set the callback only after setting the initial selected item
|
// Set the callback only after setting the initial selected item
|
||||||
mAppLinkState.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
|
mAppLinkState.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
|
||||||
@@ -157,6 +156,17 @@ public class AppLaunchSettings extends AppInfoWithHeader implements OnClickListe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int linkStateToIndex(final int state) {
|
||||||
|
switch (state) {
|
||||||
|
case INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS:
|
||||||
|
return 0; // Always
|
||||||
|
case INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER:
|
||||||
|
return 2; // Never
|
||||||
|
default:
|
||||||
|
return 1; // Ask
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private boolean updateAppLinkState(final int newState) {
|
private boolean updateAppLinkState(final int newState) {
|
||||||
if (mIsBrowser) {
|
if (mIsBrowser) {
|
||||||
// We shouldn't get into this state, but if we do make sure
|
// We shouldn't get into this state, but if we do make sure
|
||||||
|
|||||||
Reference in New Issue
Block a user