本文整理汇总了Java中android.content.pm.ApplicationInfo.FLAG_UPDATED_SYSTEM_APP属性的典型用法代码示例。如果您正苦于以下问题:Java ApplicationInfo.FLAG_UPDATED_SYSTEM_APP属性的具体用法?Java ApplicationInfo.FLAG_UPDATED_SYSTEM_APP怎么用?Java ApplicationInfo.FLAG_UPDATED_SYSTEM_APP使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.content.pm.ApplicationInfo
的用法示例。
在下文中一共展示了ApplicationInfo.FLAG_UPDATED_SYSTEM_APP属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isSysApp
public static boolean isSysApp(Context context, String pkgName) {
if (context == null || TextUtils.isEmpty(pkgName)) {
return false;
}
try {
PackageManager packageManager = context.getPackageManager();
ApplicationInfo applicationInfo = packageManager.getPackageInfo(pkgName, 0).applicationInfo;
// return (applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == ApplicationInfo.FLAG_SYSTEM;
return ((ApplicationInfo.FLAG_SYSTEM | ApplicationInfo.FLAG_UPDATED_SYSTEM_APP)
& applicationInfo.flags) != 0;
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
示例2: getNameOfAppsArray
public ArrayList<String> getNameOfAppsArray() {
PackageManager pm = context.getPackageManager();
listOfAppInfo = pm.getInstalledApplications(pm.GET_META_DATA);
for(ApplicationInfo app : listOfAppInfo) {
if(pm.getLaunchIntentForPackage(app.packageName) != null) {
// apps with launcher intent
if((app.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) == 1) {
// updated system apps
} else if ((app.flags & ApplicationInfo.FLAG_SYSTEM) == 1) {
// system apps
} else {
// user installed apps
nameOfAppsArray.add((String) pm.getApplicationLabel(app));
}
}
}
return nameOfAppsArray;
}
示例3: getAppLogosArray
public ArrayList<Drawable> getAppLogosArray() {
PackageManager pm = context.getPackageManager();
listOfAppInfo = pm.getInstalledApplications(pm.GET_META_DATA);
for(ApplicationInfo app : listOfAppInfo) {
if(pm.getLaunchIntentForPackage(app.packageName) != null) {
// apps with launcher intent
if((app.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) == 1) {
// updated system apps
} else if ((app.flags & ApplicationInfo.FLAG_SYSTEM) == 1) {
// system apps
} else {
// user installed apps
appLogosArray.add(app.loadIcon(pm));
}
}
}
return appLogosArray;
}
示例4: isSystem
public boolean isSystem() {
boolean mSystem = false;
for (ApplicationInfo appInfo : mMapAppInfo.values()) {
mSystem = ((appInfo.flags & (ApplicationInfo.FLAG_SYSTEM | ApplicationInfo.FLAG_UPDATED_SYSTEM_APP)) != 0);
mSystem = mSystem || appInfo.packageName.equals(this.getClass().getPackage().getName());
mSystem = mSystem || appInfo.packageName.equals(this.getClass().getPackage().getName() + ".pro");
mSystem = mSystem || appInfo.packageName.equals("de.robv.android.xposed.installer");
}
return mSystem;
}
示例5: isThirdPartyApp
/**
* 判断应用是否是第三方应用
*
* @param appInfo
* @return
*/
public static boolean isThirdPartyApp(ApplicationInfo appInfo) {
boolean flag = false;
if ((appInfo.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0) {
// 可更新的系统应用
flag = true;
} else if ((appInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0) {
// 非系统应用(第三方:用户自己安装)
flag = true;
}
return flag;
}
示例6: getNativeLibraryDirectory
/**
* @return the path to native libraries.
*/
@SuppressWarnings("unused")
@CalledByNative
private static String getNativeLibraryDirectory(Context appContext) {
ApplicationInfo ai = appContext.getApplicationInfo();
if ((ai.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0
|| (ai.flags & ApplicationInfo.FLAG_SYSTEM) == 0) {
return ai.nativeLibraryDir;
}
return "/system/lib/";
}
示例7: isSystemApp
private boolean isSystemApp(ApplicationInfo info) {
if ((info.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0) {
return false;
} else if ((info.flags & ApplicationInfo.FLAG_SYSTEM) == 0) {
return false;
}
return true;
}
示例8: onCreate
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Create the list view to show all the installed apps
RecyclerView mRecyclerView = findViewById(R.id.main_view);
mRecyclerView.setHasFixedSize(true);
mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
// Collect all the apps' info
ArrayList<OASPVerify> appList = new ArrayList<>();
PackageManager pm = getPackageManager();
List<ApplicationInfo> packages = pm.getInstalledApplications(0);
int isSysApp = ApplicationInfo.FLAG_SYSTEM | ApplicationInfo.FLAG_UPDATED_SYSTEM_APP;
for (ApplicationInfo app : packages) {
// Ignore system applications
if ((app.flags & isSysApp) == 0) {
// Skip the demo app itself
if (app.packageName.equals(getApplicationContext().getPackageName()))
continue;
OASPVerify oaspInfo = new OASPVerify(pm, app);
dump(oaspInfo);
appList.add(oaspInfo);
}
}
// Sort app list based on the package name
Collections.sort(appList, new Comparator<OASPVerify>() {
@Override
public int compare(OASPVerify app1, OASPVerify app2) {
return app1.pkg.compareTo(app2.pkg);
}
});
// Show it
RecyclerView.Adapter mAdapter = new ListAdapter(appList);
mRecyclerView.setAdapter(mAdapter);
}
示例9: IsSystemApp
public Boolean IsSystemApp(ApplicationInfo info) {
// 有些系统应用是可以更新的,如果用户自己下载了一个系统的应用来更新了原来的,
// 它就不是系统应用啦,这个就是判断这种情况的
if ((info.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0) {
return true;
}
else if ((info.flags & ApplicationInfo.FLAG_SYSTEM) == 0) {
return true;
}
return false;
}
示例10: isSystemApp
private static boolean isSystemApp(ApplicationInfo appInfo){
return appInfo.flags != 0 && (appInfo.flags
& (ApplicationInfo.FLAG_UPDATED_SYSTEM_APP | ApplicationInfo.FLAG_SYSTEM)) > 0;
}
示例11: isSystemApp
public static boolean isSystemApp(ApplicationInfo info) {
int mask = ApplicationInfo.FLAG_SYSTEM | ApplicationInfo.FLAG_UPDATED_SYSTEM_APP;
return (info.flags & mask) != 0;
}
示例12: isAppUseful
private static boolean isAppUseful(ApplicationInfo appInfo) {
return appInfo.flags != 0
&& ((appInfo.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0
|| (appInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0);
}
示例13: isSystemPackage
static boolean isSystemPackage(int flags) {
return (flags & (ApplicationInfo.FLAG_SYSTEM | ApplicationInfo.FLAG_UPDATED_SYSTEM_APP)) != 0;
}
示例14: getView
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View view = convertView;
if (view == null) {
view = inflater.inflate(R.layout.item, parent, false);
ViewHolder viewHolder = new ViewHolder();
viewHolder.checkView = (CheckBox) view.findViewById(R.id.check);
viewHolder.iconView = (ImageView) view.findViewById(R.id.icon);
viewHolder.nameView = (TextView) view.findViewById(R.id.name);
viewHolder.summaryView = (TextView) view.findViewById(R.id.summary);
viewHolder.loadingView = (TextView) view.findViewById(R.id.loading);
viewHolder.preventView = (ImageView) view.findViewById(R.id.prevent);
viewHolder.checkView.setOnCheckedChangeListener(mListener);
viewHolder.checkView.setTag(viewHolder);
view.setTag(viewHolder);
}
ViewHolder holder = (ViewHolder) view.getTag();
AppInfo appInfo = getItem(position);
if (appInfo == null) {
return view;
}
holder.nameView.setText(appInfo.name);
if (!PackageUtils.equals(holder.packageName, appInfo.packageName)) {
holder.summaryView.setVisibility(View.GONE);
holder.iconView.setImageDrawable(mPm.getDefaultActivityIcon());
holder.loadingView.setVisibility(View.VISIBLE);
}
holder.packageName = appInfo.packageName;
holder.checkView.setEnabled(mCanPreventNames.contains(holder.packageName));
holder.checkView.setChecked(mActivity.getSelection().contains(holder.packageName));
if (appInfo.isSystem()) {
view.setBackgroundColor(mActivity.getDangerousColor());
} else {
view.setBackgroundColor(mActivity.getTransparentColor());
}
holder.canUninstall = ((appInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0) || ((appInfo.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0);
holder.updatePreventView(mActivity);
if (holder.task != null) {
holder.task.cancel(true);
}
holder.task = new RetrieveIconTask(mActivity);
holder.task.execute(holder, appInfo);
return view;
}
示例15: isSystemPackage
public static boolean isSystemPackage(int flags) {
return (flags & (ApplicationInfo.FLAG_SYSTEM | ApplicationInfo.FLAG_UPDATED_SYSTEM_APP)) != 0;
}