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

Commit c753d0dd authored by Yanting Yang's avatar Yanting Yang Committed by Automerger Merge Worker
Browse files

Merge "Cache label description to improve scrolling of App Info page" into...

Merge "Cache label description to improve scrolling of App Info page" into rvc-dev am: cc49bc33 am: 95ac225f

Change-Id: I5b3578d9cf0bf510d83f8fbf2cf3fa1e44192160
parents c59ccec9 95ac225f
Loading
Loading
Loading
Loading
+33 −0
Original line number Diff line number Diff line
@@ -500,6 +500,20 @@ public class ApplicationsState {
        }
    }

    /**
     * To generate and cache the label description.
     *
     * @param entry contain the entries of an app
     */
    public void ensureLabelDescription(AppEntry entry) {
        if (entry.labelDescription != null) {
            return;
        }
        synchronized (entry) {
            entry.ensureLabelDescriptionLocked(mContext);
        }
    }

    public void requestSize(String packageName, int userId) {
        if (DEBUG_LOCKING) Log.v(TAG, "requestSize about to acquire lock...");
        synchronized (mEntriesMap) {
@@ -1524,6 +1538,7 @@ public class ApplicationsState {
        public long size;
        public long internalSize;
        public long externalSize;
        public String labelDescription;

        public boolean mounted;

@@ -1616,6 +1631,24 @@ public class ApplicationsState {
                return "";
            }
        }

        /**
         * Get the label description which distinguishes a personal app from a work app for
         * accessibility purpose. If the app is in a work profile, then add a "work" prefix to the
         * app label.
         *
         * @param context The application context
         */
        public void ensureLabelDescriptionLocked(Context context) {
            final int userId = UserHandle.getUserId(this.info.uid);
            if (UserManager.get(context).isManagedProfile(userId)) {
                this.labelDescription = context.getString(
                        com.android.settingslib.R.string.accessibility_work_profile_app_description,
                        this.label);
            } else {
                this.labelDescription = this.label;
            }
        }
    }

    private static boolean hasFlag(int flags, int flag) {