Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Denial permission OPPO_COMPONENT_SAFE

I have service in my app which needs to be running in background in device OPPO. I have read somewhere that we need to enable auto start in settings for app to keep service running but I have a problem with permission.

java.lang.SecurityException: Permission Denial: starting Intent { cmp=com.coloros.safecenter/.startupapp.StartupAppListActivity } from ProcessRecord{904a19d 12604:elite.driver.adsmove.com.settingpermission/u0a214} (pid=12604, uid=10214) requires oppo.permission.OPPO_COMPONENT_SAFE

When i try to do this

if (Build.MANUFACTURER.equals("OPPO")) {
    Intent[] AUTO_START_OPPO = {
        new Intent().setComponent(new ComponentName("com.coloros.safe", "com.coloros.safe.permission.startup.StartupAppListActivity")),
        new Intent().setComponent(new ComponentName("com.coloros.safe", "com.coloros.safe.permission.startupapp.StartupAppListActivity")),
        new Intent().setComponent(new ComponentName("com.coloros.safecenter", "com.coloros.safecenter.startupapp.StartupAppListActivity")),
        new Intent().setComponent(new ComponentName("com.coloros.safecenter", "com.coloros.safecenter.startup.StartupAppListActivity"))
    };

    for (Intent intent : AUTO_START_OPPO) {
        if (getPackageManager().resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY) != null) {
            try {
                startActivity(intent);
                break;
            } catch (Exception e) {
                Log.d(TAG, "OPPO - Exception: "+  e.toString());
            }
        }
    }
}

I also tried to add permission and request it but failed

<!--for OPPO-->
<uses-permission android:name="oppo.permission.OPPO_COMPONENT_SAFE" />

Looking forward to help from those who have experience about it, thank you!

like image 481
Hồ Minh Tùng Avatar asked Apr 13 '18 10:04

Hồ Minh Tùng


1 Answers

Try adding the following As the Component name

ComponentName("com.coloros.safecenter", "com.coloros.privacypermissionsentry.PermissionTopActivity")

Worked For OPPO A3 Device

like image 94
RAINA Avatar answered Oct 27 '22 03:10

RAINA