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

Commit 9e6ac3d2 authored by Amith Yamasani's avatar Amith Yamasani
Browse files

Multiuser settings revamp for L, first pass

Include Guest settings
Ability to switch users from Settings
Manage user settings like telephony access

Bug: 15761405
Change-Id: I2cfdc7bc2703ed202aa8bf1261c304c51ce48b29
parent 5b3c3c00
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -4942,6 +4942,15 @@
    <string name="user_delete_user_description">Delete user</string>
    <!-- Delete button text [CHAR LIMIT=25] -->
    <string name="user_delete_button">Delete</string>
    <!-- Title for Guest user [CHAR LIMIT=35] -->
    <string name="user_guest">Guest</string>

    <!-- Title of preference to enable calling[CHAR LIMIT=35] -->
    <string name="user_enable_calling">Enable phone calls?</string>
    <!-- Title of preference to enable calling and SMS [CHAR LIMIT=35] -->
    <string name="user_enable_calling_sms">Enable phone calls and SMS?</string>
    <!-- Title of preference to remove the user [CHAR LIMIT=35] -->
    <string name="user_remove_user">Remove user</string>

    <!-- Application Restrictions screen title [CHAR LIMIT=45] -->
    <string name="application_restrictions">Allow apps and content</string>
+28 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2014 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">

    <SwitchPreference
            android:key="enable_calling"
            android:title="@string/user_enable_calling_sms"
            android:persistent="false" />
    <Preference
            android:key="remove_user"
            android:title="@string/user_remove_user" />

</PreferenceScreen>
 No newline at end of file
+3 −2
Original line number Diff line number Diff line
@@ -683,7 +683,7 @@ public class AppRestrictionsFragment extends SettingsPreferenceFragment implemen
                            app.masterEntry.activityName));
                }
                p.setKey(getKeyForPackage(packageName));
                p.setSettingsEnabled(hasSettings || isSettingsApp);
                p.setSettingsEnabled((hasSettings || isSettingsApp) && app.masterEntry == null);
                p.setPersistent(false);
                p.setOnPreferenceChangeListener(this);
                p.setOnPreferenceClickListener(this);
@@ -702,7 +702,8 @@ public class AppRestrictionsFragment extends SettingsPreferenceFragment implemen
                    // Get and populate the defaults, since the user is not going to be
                    // able to toggle this app ON (it's ON by default and immutable).
                    // Only do this for restricted profiles, not single-user restrictions
                    if (hasSettings) {
                    // Also don't do this for slave icons
                    if (hasSettings && app.masterEntry == null) {
                        requestRestrictionsForApp(packageName, p, false);
                    }
                } else if (!mNewUser && isAppEnabledForUser(pi)) {
+52 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2014 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.settings.users;

import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.pm.UserInfo;
import android.os.UserHandle;
import android.os.UserManager;

import com.android.settings.R;

public class RemoveUserUtil {

    static Dialog createConfirmationDialog(Context context, int removingUserId,
            DialogInterface.OnClickListener onConfirmListener) {
        final UserManager um = (UserManager) context.getSystemService(Context.USER_SERVICE);
        final UserInfo userInfo = um.getUserInfo(removingUserId);
        Dialog dlg = new AlertDialog.Builder(context)
                .setTitle(UserHandle.myUserId() == removingUserId
                    ? R.string.user_confirm_remove_self_title
                    : (userInfo.isRestricted()
                        ? R.string.user_profile_confirm_remove_title
                        : R.string.user_confirm_remove_title))
                .setMessage(UserHandle.myUserId() == removingUserId
                    ? R.string.user_confirm_remove_self_message
                    : (userInfo.isRestricted()
                        ? R.string.user_profile_confirm_remove_message
                        : R.string.user_confirm_remove_message))
                .setPositiveButton(R.string.user_delete_button,
                        onConfirmListener)
                .setNegativeButton(android.R.string.cancel, null)
                .create();
        return dlg;
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -101,7 +101,7 @@ public class RestrictedProfileSettings extends AppRestrictionsFragment {
            mHeaderView.setOnClickListener(this);
            mUserIconView = (ImageView) mHeaderView.findViewById(android.R.id.icon);
            mUserNameView = (TextView) mHeaderView.findViewById(android.R.id.title);
            getListView().setFastScrollEnabled(true);
            //getListView().setFastScrollEnabled(true);
        }
        // This is going to bind the preferences.
        super.onActivityCreated(savedInstanceState);
Loading