[core] Remove grantManagerPermission (#953)
This commit is contained in:
parent
70344ff9fd
commit
5af017dc32
|
|
@ -83,11 +83,6 @@ import java.util.zip.ZipFile;
|
||||||
// This config manager assume uid won't change when our service is off.
|
// This config manager assume uid won't change when our service is off.
|
||||||
// Otherwise, user should maintain it manually.
|
// Otherwise, user should maintain it manually.
|
||||||
public class ConfigManager {
|
public class ConfigManager {
|
||||||
|
|
||||||
private static final String[] MANAGER_PERMISSIONS_TO_GRANT = new String[]{
|
|
||||||
"android.permission.WRITE_SECURE_SETTINGS"
|
|
||||||
};
|
|
||||||
|
|
||||||
private static ConfigManager instance = null;
|
private static ConfigManager instance = null;
|
||||||
|
|
||||||
private static final File basePath = new File("/data/adb/lspd");
|
private static final File basePath = new File("/data/adb/lspd");
|
||||||
|
|
@ -326,7 +321,6 @@ public class ConfigManager {
|
||||||
if (info != null) {
|
if (info != null) {
|
||||||
managerUid = info.applicationInfo.uid;
|
managerUid = info.applicationInfo.uid;
|
||||||
manager = info.packageName;
|
manager = info.packageName;
|
||||||
grantManagerPermission();
|
|
||||||
} else {
|
} else {
|
||||||
Log.w(TAG, "manager is not installed");
|
Log.w(TAG, "manager is not installed");
|
||||||
}
|
}
|
||||||
|
|
@ -339,8 +333,6 @@ public class ConfigManager {
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
if (PackageService.installManagerIfAbsent(manager, new File(basePath, "manager.apk"))) {
|
if (PackageService.installManagerIfAbsent(manager, new File(basePath, "manager.apk"))) {
|
||||||
updateManager(BuildConfig.DEFAULT_MANAGER_PACKAGE_NAME);
|
updateManager(BuildConfig.DEFAULT_MANAGER_PACKAGE_NAME);
|
||||||
} else {
|
|
||||||
Log.w(TAG, "Can not install manager");
|
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
|
|
@ -938,17 +930,6 @@ public class ConfigManager {
|
||||||
return miscPath + File.separator + "prefs" + (userId == 0 ? "" : String.valueOf(userId)) + File.separator + fileName;
|
return miscPath + File.separator + "prefs" + (userId == 0 ? "" : String.valueOf(userId)) + File.separator + fileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void grantManagerPermission() {
|
|
||||||
String managerPackageName = readText(managerPath, BuildConfig.DEFAULT_MANAGER_PACKAGE_NAME);
|
|
||||||
Arrays.stream(MANAGER_PERMISSIONS_TO_GRANT).forEach(permission -> {
|
|
||||||
try {
|
|
||||||
PackageService.grantRuntimePermission(managerPackageName, permission, 0);
|
|
||||||
} catch (RemoteException e) {
|
|
||||||
Log.e(TAG, Log.getStackTraceString(e));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// this is slow, avoid using it
|
// this is slow, avoid using it
|
||||||
public String getModule(int uid) {
|
public String getModule(int uid) {
|
||||||
for (var module : cachedModule.values()) {
|
for (var module : cachedModule.values()) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue