Update description when device allows guest user
If device supports guest user mode, app pinning recommends guest feature to user. Test: Rebuilt rom and see correct string in app pinning. Fix: 151332926 Change-Id: I6c03ecfe075fba2f4dedca18f65893f328e680aa
This commit is contained in:
@@ -9242,10 +9242,10 @@
|
|||||||
\t\n3.\tTap the app icon at the top of the screen, then tap Pin
|
\t\n3.\tTap the app icon at the top of the screen, then tap Pin
|
||||||
</string>
|
</string>
|
||||||
<!-- [CHAR LIMIT=none] Screen pinning description -->
|
<!-- [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.
|
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\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:
|
\n\nTo use app pinning:
|
||||||
\t\n1.\tTurn on app pinning
|
\t\n1.\tTurn on app pinning
|
||||||
\t\n2.\tOpen Overview
|
\t\n2.\tOpen Overview
|
||||||
|
@@ -22,6 +22,7 @@ import android.content.DialogInterface;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
|
import android.os.UserManager;
|
||||||
import android.provider.SearchIndexableResource;
|
import android.provider.SearchIndexableResource;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.widget.Switch;
|
import android.widget.Switch;
|
||||||
@@ -61,6 +62,7 @@ public class ScreenPinningSettings extends SettingsPreferenceFragment
|
|||||||
private SwitchPreference mUseScreenLock;
|
private SwitchPreference mUseScreenLock;
|
||||||
private FooterPreference mFooterPreference;
|
private FooterPreference mFooterPreference;
|
||||||
private LockPatternUtils mLockPatternUtils;
|
private LockPatternUtils mLockPatternUtils;
|
||||||
|
private UserManager mUserManager;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetricsCategory() {
|
public int getMetricsCategory() {
|
||||||
@@ -74,6 +76,7 @@ public class ScreenPinningSettings extends SettingsPreferenceFragment
|
|||||||
final SettingsActivity activity = (SettingsActivity) getActivity();
|
final SettingsActivity activity = (SettingsActivity) getActivity();
|
||||||
activity.setTitle(R.string.screen_pinning_title);
|
activity.setTitle(R.string.screen_pinning_title);
|
||||||
mLockPatternUtils = new LockPatternUtils(activity);
|
mLockPatternUtils = new LockPatternUtils(activity);
|
||||||
|
mUserManager = activity.getSystemService(UserManager.class);
|
||||||
|
|
||||||
addPreferencesFromResource(R.xml.screen_pinning_settings);
|
addPreferencesFromResource(R.xml.screen_pinning_settings);
|
||||||
final PreferenceScreen root = getPreferenceScreen();
|
final PreferenceScreen root = getPreferenceScreen();
|
||||||
@@ -224,10 +227,22 @@ public class ScreenPinningSettings extends SettingsPreferenceFragment
|
|||||||
mUseScreenLock.setTitle(getCurrentSecurityTitle());
|
mUseScreenLock.setTitle(getCurrentSecurityTitle());
|
||||||
} else {
|
} else {
|
||||||
mFooterPreference.setVisible(true);
|
mFooterPreference.setVisible(true);
|
||||||
|
mFooterPreference.setSummary(getAppPinningContent());
|
||||||
mUseScreenLock.setVisible(false);
|
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
|
* For search
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user