A new ui flow for screen pinning feature
The purpose of this change is to resolve a number of security issue around screen pinning. See more detail go/screen-pinning-allows There're a few change for Settings app. - Rename the screen pinning to app pinning. - Change the string description for app pinning. - Pop up a warning dialog while user is enabling this feature. Test: Rebuilt rom and see new ui flow. Bug: 151332926 Change-Id: Ife07d7b95ab5dccb2aed7f2bc8fa32f97763bd63
This commit is contained in:
@@ -9219,9 +9219,34 @@
|
||||
<string name="switch_off_text">Off</string>
|
||||
|
||||
<!-- [CHAR LIMIT=28] Screen pinning title -->
|
||||
<string name="screen_pinning_title">Screen pinning</string>
|
||||
<!-- [CHAR LIMIT=300] Screen pinning description -->
|
||||
<string name="screen_pinning_description">When this setting is turned on, you can use screen pinning to keep the current screen in view until you unpin.\n\nTo use screen pinning:\n\n1. Make sure screen pinning is turned on\n\n2. Open Overview\n\n3. Tap the app icon at the top of the screen, then tap Pin</string>
|
||||
<string name="screen_pinning_title">App pinning</string>
|
||||
<!-- [CHAR LIMIT=none] Screen pinning description -->
|
||||
<string name="screen_pinning_description">
|
||||
App pinning allows you to keep the current app in view until you unpin it. This feature can be used, for example, to let a trusted friend play a specific game.
|
||||
\n\nWhen an app is pinned, the pinned app may open other apps and personal data may be accessible.
|
||||
\n\nTo use app pinning:
|
||||
\t\n1.\tTurn on app pinning
|
||||
\t\n2.\tOpen Overview
|
||||
\t\n3.\tTap the app icon at the top of the screen, then tap Pin
|
||||
</string>
|
||||
<!-- [CHAR LIMIT=none] Screen pinning description -->
|
||||
<string name="screen_pinning_guest_mode_description">
|
||||
App pinning allows you to keep the current app in view until you unpin it. This feature can be used, for example, to let a trusted friend play a specific game.
|
||||
\n\nWhen an app is pinned, the pinned app may open other apps and personal data may be accessible.
|
||||
\n\nIf you want to securely share your device with someone, try using a guest profile instead.
|
||||
\n\nTo use app pinning:
|
||||
\t\n1.\tTurn on app pinning
|
||||
\t\n2.\tOpen Overview
|
||||
\t\n3.\tTap the app icon at the top of the screen, then tap Pin
|
||||
</string>
|
||||
<!-- [CHAR LIMIT=300] Screen pinning title -->
|
||||
<string name="screen_pinning_dialog_message">
|
||||
When app is pinned:
|
||||
\n\n\u2022\t\tPersonal data may be accessible
|
||||
\n\t\t(such as contacts and email content)
|
||||
\n\u2022\t\tPinned app may open other apps
|
||||
\n\nOnly use app pinning with people you trust.
|
||||
</string>
|
||||
<!-- [CHAR LIMIT=60] Unlock setting for screen pinning -->
|
||||
<string name="screen_pinning_unlock_pattern">Ask for unlock pattern before unpinning</string>
|
||||
<!-- [CHAR LIMIT=60] Unlock setting for screen pinning -->
|
||||
|
@@ -18,6 +18,7 @@ package com.android.settings.security;
|
||||
import android.app.admin.DevicePolicyManager;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.UserHandle;
|
||||
@@ -25,6 +26,7 @@ import android.provider.SearchIndexableResource;
|
||||
import android.provider.Settings;
|
||||
import android.widget.Switch;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.Preference.OnPreferenceChangeListener;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
@@ -43,12 +45,13 @@ import com.android.settingslib.widget.FooterPreference;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* Screen pinning settings.
|
||||
*/
|
||||
@SearchIndexable
|
||||
public class ScreenPinningSettings extends SettingsPreferenceFragment
|
||||
implements SwitchBar.OnSwitchChangeListener {
|
||||
implements SwitchBar.OnSwitchChangeListener, DialogInterface.OnClickListener {
|
||||
|
||||
private static final String KEY_USE_SCREEN_LOCK = "use_screen_lock";
|
||||
private static final String KEY_FOOTER = "screen_pinning_settings_screen_footer";
|
||||
@@ -78,9 +81,9 @@ public class ScreenPinningSettings extends SettingsPreferenceFragment
|
||||
mFooterPreference = root.findPreference(KEY_FOOTER);
|
||||
|
||||
mSwitchBar = activity.getSwitchBar();
|
||||
mSwitchBar.addOnSwitchChangeListener(this);
|
||||
mSwitchBar.show();
|
||||
mSwitchBar.setChecked(isLockToAppEnabled(getActivity()));
|
||||
mSwitchBar.addOnSwitchChangeListener(this);
|
||||
|
||||
updateDisplay();
|
||||
}
|
||||
@@ -184,7 +187,26 @@ public class ScreenPinningSettings extends SettingsPreferenceFragment
|
||||
*/
|
||||
@Override
|
||||
public void onSwitchChanged(Switch switchView, boolean isChecked) {
|
||||
setLockToAppEnabled(isChecked);
|
||||
if (isChecked) {
|
||||
new AlertDialog.Builder(getContext())
|
||||
.setMessage(R.string.screen_pinning_dialog_message)
|
||||
.setPositiveButton(R.string.dlg_ok, this)
|
||||
.setNegativeButton(R.string.dlg_cancel, this)
|
||||
.setCancelable(false)
|
||||
.show();
|
||||
} else {
|
||||
setLockToAppEnabled(false);
|
||||
updateDisplay();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int which) {
|
||||
if (which == DialogInterface.BUTTON_POSITIVE) {
|
||||
setLockToAppEnabled(true);
|
||||
} else {
|
||||
mSwitchBar.setChecked(false);
|
||||
}
|
||||
updateDisplay();
|
||||
}
|
||||
|
||||
@@ -210,14 +232,14 @@ public class ScreenPinningSettings extends SettingsPreferenceFragment
|
||||
* For search
|
||||
*/
|
||||
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
new BaseSearchIndexProvider() {
|
||||
new BaseSearchIndexProvider() {
|
||||
|
||||
@Override
|
||||
public List<SearchIndexableResource> getXmlResourcesToIndex(Context context,
|
||||
boolean enabled) {
|
||||
final SearchIndexableResource sir = new SearchIndexableResource(context);
|
||||
sir.xmlResId = R.xml.screen_pinning_settings;
|
||||
return Arrays.asList(sir);
|
||||
}
|
||||
};
|
||||
@Override
|
||||
public List<SearchIndexableResource> getXmlResourcesToIndex(Context context,
|
||||
boolean enabled) {
|
||||
final SearchIndexableResource sir = new SearchIndexableResource(context);
|
||||
sir.xmlResId = R.xml.screen_pinning_settings;
|
||||
return Arrays.asList(sir);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user