Merge "Update restricted setting dialog, unlock toast, and menu strings" into tm-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
d84516dd28
@@ -4680,8 +4680,8 @@
|
|||||||
<string name="clear_user_data_text">Clear storage</string>
|
<string name="clear_user_data_text">Clear storage</string>
|
||||||
<!-- Manage applications, restore updated system application to factory version -->
|
<!-- Manage applications, restore updated system application to factory version -->
|
||||||
<string name="app_factory_reset">Uninstall updates</string>
|
<string name="app_factory_reset">Uninstall updates</string>
|
||||||
<!-- [CHAR LIMIT=50] Manage applications, unlock restricted settings from lock screen title -->
|
<!-- [CHAR LIMIT=50] Manage applications, unlock restricted setting from lock screen title -->
|
||||||
<string name="app_restricted_settings_lockscreen_title">Unlock restricted settings</string>
|
<string name="app_restricted_settings_lockscreen_title">Allow restricted settings</string>
|
||||||
<!-- Manage applications, individual application info screen, screen, message text under Launch by default heading. This is present if the app is set as a default for some actions. -->
|
<!-- Manage applications, individual application info screen, screen, message text under Launch by default heading. This is present if the app is set as a default for some actions. -->
|
||||||
<string name="auto_launch_enable_text">Some activities you\u2019ve selected open in this app by default.</string>
|
<string name="auto_launch_enable_text">Some activities you\u2019ve selected open in this app by default.</string>
|
||||||
<!-- Manage applications, individual application info screen, screen, message text under Launch by default heading. This is present if the app was given user permission to create widgets. -->
|
<!-- Manage applications, individual application info screen, screen, message text under Launch by default heading. This is present if the app was given user permission to create widgets. -->
|
||||||
@@ -12166,7 +12166,9 @@
|
|||||||
<!-- Button label to allow the user to view additional information [CHAR LIMIT=NONE BACKUP_MESSAGE_ID=2416766240581561009] -->
|
<!-- Button label to allow the user to view additional information [CHAR LIMIT=NONE BACKUP_MESSAGE_ID=2416766240581561009] -->
|
||||||
<string name="learn_more">Learn more</string>
|
<string name="learn_more">Learn more</string>
|
||||||
<!--Title for dialog displayed to tell user that settings are blocked by setting restrictions [CHAR LIMIT=50] -->
|
<!--Title for dialog displayed to tell user that settings are blocked by setting restrictions [CHAR LIMIT=50] -->
|
||||||
<string name="blocked_by_restricted_settings_title">Restricted Settings</string>
|
<string name="blocked_by_restricted_settings_title">Restricted setting</string>
|
||||||
|
<!--Toast message shown after the user successfully allows restricted settings [CHAR LIMIT=50] -->
|
||||||
|
<string name="toast_allows_restricted_settings_successfully">Restricted settings allowed for <xliff:g id="app_name" example="Gmail">%s</xliff:g></string>
|
||||||
<!--Content for dialog displayed to tell user that settings are blocked by setting restrictions [CHAR LIMIT=100] -->
|
<!--Content for dialog displayed to tell user that settings are blocked by setting restrictions [CHAR LIMIT=100] -->
|
||||||
<string name="blocked_by_restricted_settings_content">For your security, this setting is currently unavailable.</string>
|
<string name="blocked_by_restricted_settings_content">For your security, this setting is currently unavailable.</string>
|
||||||
|
|
||||||
|
@@ -48,6 +48,7 @@ import android.util.Log;
|
|||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
|
|
||||||
@@ -443,14 +444,14 @@ public class AppInfoDashboardFragment extends DashboardFragment
|
|||||||
};
|
};
|
||||||
|
|
||||||
final BiometricPrompt.Builder builder = new BiometricPrompt.Builder(context)
|
final BiometricPrompt.Builder builder = new BiometricPrompt.Builder(context)
|
||||||
.setTitle(context.getText(R.string.app_restricted_settings_lockscreen_title));
|
.setUseDefaultTitle(); // use default title if title is null/empty
|
||||||
|
|
||||||
if (context.getSystemService(BiometricManager.class).canAuthenticate(
|
final BiometricManager bm = context.getSystemService(BiometricManager.class);
|
||||||
BiometricManager.Authenticators.DEVICE_CREDENTIAL
|
final int authenticators = BiometricManager.Authenticators.DEVICE_CREDENTIAL
|
||||||
| BiometricManager.Authenticators.BIOMETRIC_WEAK)
|
| BiometricManager.Authenticators.BIOMETRIC_WEAK;
|
||||||
== BiometricManager.BIOMETRIC_SUCCESS) {
|
if (bm.canAuthenticate(authenticators) == BiometricManager.BIOMETRIC_SUCCESS) {
|
||||||
builder.setAllowedAuthenticators(BiometricManager.Authenticators.DEVICE_CREDENTIAL
|
builder.setAllowedAuthenticators(authenticators);
|
||||||
| BiometricManager.Authenticators.BIOMETRIC_WEAK);
|
builder.setSubtitle(bm.getStrings(authenticators).getPromptMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
final BiometricPrompt bp = builder.build();
|
final BiometricPrompt bp = builder.build();
|
||||||
@@ -481,6 +482,10 @@ public class AppInfoDashboardFragment extends DashboardFragment
|
|||||||
getPackageName(),
|
getPackageName(),
|
||||||
AppOpsManager.MODE_ALLOWED);
|
AppOpsManager.MODE_ALLOWED);
|
||||||
getActivity().invalidateOptionsMenu();
|
getActivity().invalidateOptionsMenu();
|
||||||
|
final String toastString = getContext().getString(
|
||||||
|
R.string.toast_allows_restricted_settings_successfully,
|
||||||
|
mAppEntry.label);
|
||||||
|
Toast.makeText(getContext(), toastString, Toast.LENGTH_LONG).show();
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user