Merge "Create an API to generate a content description for app name" into rvc-dev am: bd38efdcc2
Change-Id: Ic3f65716e218a6c030fc4c8313dfc183697a10b4
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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;
|
||||
@@ -129,7 +130,7 @@ public class AppUtils {
|
||||
*/
|
||||
public static boolean isHiddenSystemModule(Context context, String packageName) {
|
||||
return ApplicationsState.getInstance((Application) context.getApplicationContext())
|
||||
.isHiddenModule(packageName);
|
||||
.isHiddenModule(packageName);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user