Loading packages/SystemUI/res/values-sw600dp/bools.xml 0 → 100644 +21 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- * Copyright (c) 2018, 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. */ --> <resources> <!-- Whether to show the user switcher in quick settings when only a single user is present. --> <bool name="qs_show_user_switcher_for_single_user">true</bool> </resources> packages/SystemUI/res/values/bools.xml 0 → 100644 +21 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- * Copyright (c) 2018, 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. */ --> <resources> <!-- Whether to show the user switcher in quick settings when only a single user is present. --> <bool name="qs_show_user_switcher_for_single_user">false</bool> </resources> packages/SystemUI/src/com/android/systemui/qs/QSFooterImpl.java +22 −8 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import static android.app.StatusBarManager.DISABLE2_QUICK_SETTINGS; import android.content.Context; import android.content.Intent; import android.content.pm.UserInfo; import android.content.res.ColorStateList; import android.content.res.Configuration; import android.graphics.PorterDuff.Mode; Loading Loading @@ -49,7 +50,6 @@ import com.android.systemui.R.dimen; import com.android.systemui.SysUiServiceProvider; import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.qs.TouchAnimator.Builder; import com.android.systemui.qs.tileimpl.QSTileImpl; import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.phone.MultiUserSwitch; import com.android.systemui.statusbar.phone.SettingsButton; Loading Loading @@ -257,17 +257,31 @@ public class QSFooterImpl extends FrameLayout implements QSFooter, mSettingsContainer.setVisibility(mQsDisabled ? View.GONE : View.VISIBLE); mSettingsContainer.findViewById(R.id.tuner_icon).setVisibility( TunerService.isTunerEnabled(mContext) ? View.VISIBLE : View.INVISIBLE); final boolean isDemo = UserManager.isDeviceInDemoMode(mContext); mMultiUserSwitch.setVisibility(mExpanded && UserManager.get(mContext).isUserSwitcherEnabled() ? View.VISIBLE : View.INVISIBLE); mMultiUserSwitch.setVisibility(showUserSwitcher(isDemo) ? View.VISIBLE : View.INVISIBLE); mEdit.setVisibility(isDemo || !mExpanded ? View.INVISIBLE : View.VISIBLE); } private boolean showUserSwitcher(boolean isDemo) { if (!mExpanded || isDemo || !UserManager.supportsMultipleUsers()) { return false; } UserManager userManager = UserManager.get(mContext); if (userManager.hasUserRestriction(UserManager.DISALLOW_USER_SWITCH)) { return false; } int switchableUserCount = 0; for (UserInfo user : userManager.getUsers(true)) { if (user.supportsSwitchToByUser()) { ++switchableUserCount; if (switchableUserCount > 1) { return true; } } } return getResources().getBoolean(R.bool.qs_show_user_switcher_for_single_user); } private void updateListeners() { if (mListening) { mUserInfoController.addCallback(this); Loading Loading
packages/SystemUI/res/values-sw600dp/bools.xml 0 → 100644 +21 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- * Copyright (c) 2018, 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. */ --> <resources> <!-- Whether to show the user switcher in quick settings when only a single user is present. --> <bool name="qs_show_user_switcher_for_single_user">true</bool> </resources>
packages/SystemUI/res/values/bools.xml 0 → 100644 +21 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- * Copyright (c) 2018, 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. */ --> <resources> <!-- Whether to show the user switcher in quick settings when only a single user is present. --> <bool name="qs_show_user_switcher_for_single_user">false</bool> </resources>
packages/SystemUI/src/com/android/systemui/qs/QSFooterImpl.java +22 −8 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import static android.app.StatusBarManager.DISABLE2_QUICK_SETTINGS; import android.content.Context; import android.content.Intent; import android.content.pm.UserInfo; import android.content.res.ColorStateList; import android.content.res.Configuration; import android.graphics.PorterDuff.Mode; Loading Loading @@ -49,7 +50,6 @@ import com.android.systemui.R.dimen; import com.android.systemui.SysUiServiceProvider; import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.qs.TouchAnimator.Builder; import com.android.systemui.qs.tileimpl.QSTileImpl; import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.phone.MultiUserSwitch; import com.android.systemui.statusbar.phone.SettingsButton; Loading Loading @@ -257,17 +257,31 @@ public class QSFooterImpl extends FrameLayout implements QSFooter, mSettingsContainer.setVisibility(mQsDisabled ? View.GONE : View.VISIBLE); mSettingsContainer.findViewById(R.id.tuner_icon).setVisibility( TunerService.isTunerEnabled(mContext) ? View.VISIBLE : View.INVISIBLE); final boolean isDemo = UserManager.isDeviceInDemoMode(mContext); mMultiUserSwitch.setVisibility(mExpanded && UserManager.get(mContext).isUserSwitcherEnabled() ? View.VISIBLE : View.INVISIBLE); mMultiUserSwitch.setVisibility(showUserSwitcher(isDemo) ? View.VISIBLE : View.INVISIBLE); mEdit.setVisibility(isDemo || !mExpanded ? View.INVISIBLE : View.VISIBLE); } private boolean showUserSwitcher(boolean isDemo) { if (!mExpanded || isDemo || !UserManager.supportsMultipleUsers()) { return false; } UserManager userManager = UserManager.get(mContext); if (userManager.hasUserRestriction(UserManager.DISALLOW_USER_SWITCH)) { return false; } int switchableUserCount = 0; for (UserInfo user : userManager.getUsers(true)) { if (user.supportsSwitchToByUser()) { ++switchableUserCount; if (switchableUserCount > 1) { return true; } } } return getResources().getBoolean(R.bool.qs_show_user_switcher_for_single_user); } private void updateListeners() { if (mListening) { mUserInfoController.addCallback(this); Loading