Launcher is an application under the responsibility of the phone manufacturer. Power then is not always "com.android.launcher2.settings" . The tube manufacturer can rewrite your own. It could be "com.android.twlauncher" or something else depending on the Java package.
You need to get the correct permissions by searching for a provider that declares read / write permissions to "com.android.launcher.permission.READ_SETTINGS" or "com.android.launcher.permission.WRITE_SETTINGS" .
This is sample code for this:
static String getAuthorityFromPermission(Context context, String permission){ if (permission == null) return null; List<PackageInfo> packs = context.getPackageManager().getInstalledPackages(PackageManager.GET_PROVIDERS); if (packs != null) { for (PackageInfo pack : packs) { ProviderInfo[] providers = pack.providers; if (providers != null) { for (ProviderInfo provider : providers) { if (permission.equals(provider.readPermission)) return provider.authority; if (permission.equals(provider.writePermission)) return provider.authority; } } } } return null; }
Typically, the structure of ContentProvider and DB is preserved, and you can use the same queries.
Fredg source share