use of android.content.pm.ApplicationInfo in project android_frameworks_base by ParanoidAndroid.
the class InputMethodInfo method buildDummyResolveInfo.
private static ResolveInfo buildDummyResolveInfo(String packageName, String className, CharSequence label) {
ResolveInfo ri = new ResolveInfo();
ServiceInfo si = new ServiceInfo();
ApplicationInfo ai = new ApplicationInfo();
ai.packageName = packageName;
ai.enabled = true;
si.applicationInfo = ai;
si.enabled = true;
si.packageName = packageName;
si.name = className;
si.exported = true;
si.nonLocalizedLabel = label;
ri.serviceInfo = si;
return ri;
}
use of android.content.pm.ApplicationInfo in project android_frameworks_base by ParanoidAndroid.
the class InputMethodUtils method setNonSelectedSystemImesDisabledUntilUsed.
public static void setNonSelectedSystemImesDisabledUntilUsed(PackageManager packageManager, List<InputMethodInfo> enabledImis) {
if (DEBUG) {
Slog.d(TAG, "setNonSelectedSystemImesDisabledUntilUsed");
}
final String[] systemImesDisabledUntilUsed = Resources.getSystem().getStringArray(com.android.internal.R.array.config_disabledUntilUsedPreinstalledImes);
if (systemImesDisabledUntilUsed == null || systemImesDisabledUntilUsed.length == 0) {
return;
}
// Only the current spell checker should be treated as an enabled one.
final SpellCheckerInfo currentSpellChecker = TextServicesManager.getInstance().getCurrentSpellChecker();
for (final String packageName : systemImesDisabledUntilUsed) {
if (DEBUG) {
Slog.d(TAG, "check " + packageName);
}
boolean enabledIme = false;
for (int j = 0; j < enabledImis.size(); ++j) {
final InputMethodInfo imi = enabledImis.get(j);
if (packageName.equals(imi.getPackageName())) {
enabledIme = true;
break;
}
}
if (enabledIme) {
// enabled ime. skip
continue;
}
if (currentSpellChecker != null && packageName.equals(currentSpellChecker.getPackageName())) {
// enabled spell checker. skip
if (DEBUG) {
Slog.d(TAG, packageName + " is the current spell checker. skip");
}
continue;
}
ApplicationInfo ai = null;
try {
ai = packageManager.getApplicationInfo(packageName, PackageManager.GET_DISABLED_UNTIL_USED_COMPONENTS);
} catch (NameNotFoundException e) {
Slog.w(TAG, "NameNotFoundException: " + packageName, e);
}
if (ai == null) {
// No app found for packageName
continue;
}
final boolean isSystemPackage = (ai.flags & ApplicationInfo.FLAG_SYSTEM) != 0;
if (!isSystemPackage) {
continue;
}
setDisabledUntilUsed(packageManager, packageName);
}
}
use of android.content.pm.ApplicationInfo in project android_frameworks_base by ParanoidAndroid.
the class HeavyWeightSwitcherActivity method setIconAndText.
void setIconAndText(int iconId, int actionId, int descriptionId, String packageName, int actionStr, int descriptionStr) {
CharSequence appName = "";
Drawable appIcon = null;
if (mCurApp != null) {
try {
ApplicationInfo info = getPackageManager().getApplicationInfo(packageName, 0);
appName = info.loadLabel(getPackageManager());
appIcon = info.loadIcon(getPackageManager());
} catch (PackageManager.NameNotFoundException e) {
}
}
setDrawable(iconId, appIcon);
setText(actionId, getString(actionStr, appName));
setText(descriptionId, getText(descriptionStr));
}
use of android.content.pm.ApplicationInfo in project android_frameworks_base by ParanoidAndroid.
the class AppSecurityPermissions method setPermissions.
private void setPermissions(List<MyPermissionInfo> permList) {
if (permList != null) {
// First pass to group permissions
for (MyPermissionInfo pInfo : permList) {
if (localLOGV)
Log.i(TAG, "Processing permission:" + pInfo.name);
if (!isDisplayablePermission(pInfo, pInfo.mNewReqFlags, pInfo.mExistingReqFlags)) {
if (localLOGV)
Log.i(TAG, "Permission:" + pInfo.name + " is not displayable");
continue;
}
MyPermissionGroupInfo group = mPermGroups.get(pInfo.group);
if (group != null) {
pInfo.mLabel = pInfo.loadLabel(mPm);
addPermToList(group.mAllPermissions, pInfo);
if (pInfo.mNew) {
addPermToList(group.mNewPermissions, pInfo);
}
if ((group.flags & PermissionGroupInfo.FLAG_PERSONAL_INFO) != 0) {
addPermToList(group.mPersonalPermissions, pInfo);
} else {
addPermToList(group.mDevicePermissions, pInfo);
}
}
}
}
for (MyPermissionGroupInfo pgrp : mPermGroups.values()) {
if (pgrp.labelRes != 0 || pgrp.nonLocalizedLabel != null) {
pgrp.mLabel = pgrp.loadLabel(mPm);
} else {
ApplicationInfo app;
try {
app = mPm.getApplicationInfo(pgrp.packageName, 0);
pgrp.mLabel = app.loadLabel(mPm);
} catch (NameNotFoundException e) {
pgrp.mLabel = pgrp.loadLabel(mPm);
}
}
mPermGroupsList.add(pgrp);
}
Collections.sort(mPermGroupsList, mPermGroupComparator);
if (localLOGV) {
for (MyPermissionGroupInfo grp : mPermGroupsList) {
Log.i(TAG, "Group " + grp.name + " personal=" + ((grp.flags & PermissionGroupInfo.FLAG_PERSONAL_INFO) != 0) + " priority=" + grp.priority);
}
}
}
use of android.content.pm.ApplicationInfo in project android_frameworks_base by ParanoidAndroid.
the class InputMethodTest method createDummyInputMethodInfo.
private static InputMethodInfo createDummyInputMethodInfo(String packageName, String name, CharSequence label, boolean isAuxIme, boolean isDefault, List<InputMethodSubtype> subtypes) {
final ResolveInfo ri = new ResolveInfo();
final ServiceInfo si = new ServiceInfo();
final ApplicationInfo ai = new ApplicationInfo();
ai.packageName = packageName;
ai.enabled = true;
ai.flags |= ApplicationInfo.FLAG_SYSTEM;
si.applicationInfo = ai;
si.enabled = true;
si.packageName = packageName;
si.name = name;
si.exported = true;
si.nonLocalizedLabel = label;
ri.serviceInfo = si;
return new InputMethodInfo(ri, isAuxIme, "", subtypes, 1, isDefault);
}
Aggregations