Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f858411e authored by Tsung-Mao Fang's avatar Tsung-Mao Fang Committed by Automerger Merge Worker
Browse files

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

Change-Id: If351e1790ccd6abc5686899558d231550bbd7145
parents 2ae4a108 6b82df26
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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
+15 −0
Original line number Diff line number Diff line
@@ -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
     */