编程知识 cdmana.com

Android 10 hides the multi-user icon under the system UI lock screen

 Insert picture description here demand : Pictured above , You need to hide the multi-user blue icon in the upper right corner .
The results are as follows :
 Insert picture description here

Lock screen related layout in SystemUI

frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java

    // Update the visibility of multi-user icons 
    private void updateVisibilities() {
   
   
        if (mMultiUserSwitch.getParent() != mStatusIconArea && !mKeyguardUserSwitcherShowing) {
   
   
            if (mMultiUserSwitch.getParent() != null) {
   
   
                getOverlay().remove(mMultiUserSwitch);
            }
            mStatusIconArea.addView(mMultiUserSwitch, 0);
        } else if (mMultiUserSwitch.getParent() == mStatusIconArea && mKeyguardUserSwitcherShowing) {
   
   
            mStatusIconArea.removeView(mMultiUserSwitch);
        }
        if (mKeyguardUserSwitcher == null) {
   
   
            // If we have no keyguard switcher, the screen width is under 600dp. In this case,
            // we only show the multi-user switch if it's enabled through UserManager as well as
            // by the user.
            // Controls whether it is displayed or not 
            if (mMultiUserSwitch.isMultiUserEnabled()) {
   
   
                mMultiUserSwitch.setVisibility(View.VISIBLE);
            } else {
   
   
                mMultiUserSwitch.setVisibility(View.GONE);
            }
        }
        // Just make it invisible and it will take effect 
        mMultiUserSwitch.setVisibility(View.GONE);
        mBatteryView.setForceShowPercent(mBatteryCharging && mShowPercentAvailable);
    }

mMultiUserSwitch It's a multi-user control , The corresponding code is in
frameworks/base/packages/SystemUI/res/layout/keyguard_status_bar.xml

        <com.android.systemui.statusbar.phone.MultiUserSwitch android:id="@+id/multi_user_switch"
            android:layout_width="@dimen/multi_user_switch_width_keyguard"
            android:layout_height="match_parent"
            android:background="@drawable/ripple_drawable"
            android:layout_marginEnd="@dimen/multi_user_switch_keyguard_margin">
            <ImageView android:id="@+id/multi_user_avatar"
                android:layout_width="@dimen/multi_user_avatar_keyguard_size"
                android:layout_height="@dimen/multi_user_avatar_keyguard_size"
                android:layout_gravity="center"
                android:scaleType="centerInside"/>
        </com.android.systemui.statusbar.phone.MultiUserSwitch>

Readers can view it by themselves , complete ~

版权声明
本文为[osc_ 7z601p6x]所创,转载请带上原文链接,感谢
https://cdmana.com/2020/12/20201224102147114r.html

Scroll to Top