Merge "Update description when device allows guest user" into rvc-dev am: 6b82df2603 am: f858411efc

Change-Id: I2ec151fa1088a2ab7a718d4334d3e829bc4cdc8a
This commit is contained in:
Tsung-Mao Fang
2020-05-06 09:43:57 +00:00
committed by Automerger Merge Worker
2 changed files with 17 additions and 2 deletions

View File

@@ -9250,10 +9250,10 @@
\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">
<string name="screen_pinning_guest_user_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\nIf you want to securely share your device with someone, try using a guest user instead.
\n\nTo use app pinning:
\t\n1.\tTurn on app pinning
\t\n2.\tOpen Overview

View File

@@ -22,6 +22,7 @@ import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.os.UserHandle;
import android.os.UserManager;
import android.provider.SearchIndexableResource;
import android.provider.Settings;
import android.widget.Switch;
@@ -61,6 +62,7 @@ public class ScreenPinningSettings extends SettingsPreferenceFragment
private SwitchPreference mUseScreenLock;
private FooterPreference mFooterPreference;
private LockPatternUtils mLockPatternUtils;
private UserManager mUserManager;
@Override
public int getMetricsCategory() {
@@ -74,6 +76,7 @@ public class ScreenPinningSettings extends SettingsPreferenceFragment
final SettingsActivity activity = (SettingsActivity) getActivity();
activity.setTitle(R.string.screen_pinning_title);
mLockPatternUtils = new LockPatternUtils(activity);
mUserManager = activity.getSystemService(UserManager.class);
addPreferencesFromResource(R.xml.screen_pinning_settings);
final PreferenceScreen root = getPreferenceScreen();
@@ -224,10 +227,22 @@ public class ScreenPinningSettings extends SettingsPreferenceFragment
mUseScreenLock.setTitle(getCurrentSecurityTitle());
} else {
mFooterPreference.setVisible(true);
mFooterPreference.setSummary(getAppPinningContent());
mUseScreenLock.setVisible(false);
}
}
private boolean isGuestModeSupported() {
return UserManager.supportsMultipleUsers()
&& !mUserManager.hasUserRestriction(UserManager.DISALLOW_USER_SWITCH);
}
private CharSequence getAppPinningContent() {
return isGuestModeSupported()
? getActivity().getText(R.string.screen_pinning_guest_user_description)
: getActivity().getText(R.string.screen_pinning_description);
}
/**
* For search
*/