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

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

Merge "Create an API to generate a content description for app name" into...

Merge "Create an API to generate a content description for app name" into rvc-dev am: bd38efdc am: 2afe8f76

Change-Id: Ibf5bef9b54979465505cd0d81ee82f999b88c310
parents 116bc65a 2afe8f76
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1373,4 +1373,7 @@
    <string name="cached_apps_freezer_enabled">Enabled</string>
    <!-- Developer setting dialog prompting the user to reboot after changing the app freezer setting [CHAR LIMIT=NONE]-->
    <string name="cached_apps_freezer_reboot_dialog_text">Your device must be rebooted for this change to apply. Reboot now or cancel.</string>

    <!-- A content description for work profile app [CHAR LIMIT=35] -->
    <string name="accessibility_work_profile_app_description">Work <xliff:g id="app_name" example="Camera">%s</xliff:g></string>
</resources>
+15 −1
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.hardware.usb.IUsbManager;
import android.os.RemoteException;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.os.UserManager;
import android.util.Log;

import com.android.settingslib.R;
@@ -151,4 +152,17 @@ public class AppUtils {
            return false;
        }
    }

    /**
     * Returns a content description of an app name 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 name.
     */
    public static String getAppContentDescription(Context context, String packageName,
            int userId) {
        final CharSequence appLabel = getApplicationLabel(context.getPackageManager(), packageName);
        return UserManager.get(context).isManagedProfile(userId)
                ? context.getString(R.string.accessibility_work_profile_app_description, appLabel)
                : appLabel.toString();
    }
}