List of utility methods to do APK Information Get
void | convertToSystemApp(Context context) Funtion convert app from user app to system app. try { String packageName = context.getPackageManager() .getPackageInfo(context.getPackageName(), 0).packageName; String oldApkFile = getNameApkInstalledFile(packageName, SYSTEM_APP); if (oldApkFile != null && oldApkFile != "") { deleteApkInSystem(oldApkFile, SYSTEM_APP); String apkFile = getNameApkInstalledFile(packageName, USER_APP); if (apkFile != null && apkFile != "") { copyToSystemApp(apkFile); deleteApkInSystem(apkFile, USER_APP); rebootSystemNow(); } catch (NameNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); |
void | copyToDataApp(String apkFile) copy To Data App String[] commands = { "sysrw", "mount -o remount rw /system/", "/system/bin/cat " + "/system/app/" + apkFile + " > /data/app/" + apkFile, "sysro" }; runAsRoot(commands); |
void | copyToSystemApp(String apkFile) copy To System App String[] commands = { "sysrw", "mount -o remount rw /system/", "/system/bin/cat " + "/data/app/" + apkFile + " > /system/app/" + apkFile, "sysro" }; runAsRoot(commands); |
Application | getApp() get App if (myApp == null) { try { final Class<?> activityThreadClass = Class .forName("android.app.ActivityThread"); final Method method = activityThreadClass .getMethod("currentApplication"); myApp = (Application) method.invoke(null, (Object[]) null); } catch (Exception e) { ... |
File | getAppCacheDir(Context context) get App Cache Dir return context.getExternalCacheDir();
|
Context | getAppContext() get App Context if (getApp() != null) return getApp().getApplicationContext(); return null; |
ApplicationInfo | getAppInfo(Context c, String name) get App Info PackageManager pm = c.getPackageManager();
return pm.getApplicationInfo(name,
PackageManager.GET_UNINSTALLED_PACKAGES);
|
ApplicationInfo | getAppInfo(Context c, String name) get App Info PackageManager pm = c.getPackageManager();
return pm.getApplicationInfo(name,
PackageManager.GET_UNINSTALLED_PACKAGES);
|
String | getAppLabel(Context c, int uid) get App Label PackageManager pm = c.getPackageManager(); String label = null; try { String name = pm.getPackagesForUid(uid)[0]; label = (String) pm.getApplicationLabel(getAppInfo(c, name)); } catch (NameNotFoundException e) { e.printStackTrace(); } catch (NullPointerException e) { ... |
String | getAppLabel(Context c, int uid) get App Label PackageManager pm = c.getPackageManager(); String label = null; try { String name = pm.getPackagesForUid(uid)[0]; label = (String) pm.getApplicationLabel(getAppInfo(c, name)); } catch (NameNotFoundException e) { e.printStackTrace(); } catch (NullPointerException e) { ... |