Skip to content

Commit

Permalink
oppo
Browse files Browse the repository at this point in the history
  • Loading branch information
mylhyl committed May 22, 2019
1 parent 1c28914 commit fa31070
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 31 deletions.
20 changes: 9 additions & 11 deletions library/src/main/java/com/mylhyl/acp/os/HuaWei.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
*/
public class HuaWei implements SettingPage {

private static final String PKG = "com.huawei.systemmanager";
private static final String MAIN_CLS = "com.huawei.permissionmanager.ui.MainActivity";
private Context context;

public HuaWei(Context context) {
Expand All @@ -19,17 +17,17 @@ public HuaWei(Context context) {

@Override
public Intent createIntent() throws PackageManager.NameNotFoundException {
// Intent intent = new Intent("android.intent.action.MANAGE_APP_PERMISSIONS");
// Uri uri = Uri.fromParts(EXTRA_PKG, context.getPackageName(), null);
// intent.setData(uri);
//intent.setClassName("com.android.packageinstaller", "com.android.packageinstaller.permission.ui
// .ManagePermissionsActivity");

Intent intent = new Intent();
intent.setClassName(PKG, MAIN_CLS);
intent.putExtra("packageName", context.getPackageName());
intent.putExtra(EXTRA_PKG_NAME, context.getPackageName());
if (OsHelper.isActivityExported(context, intent)) {
intent = null;
intent.putExtra(EXTRA_PKG, context.getPackageName());

intent.setClassName("com.huawei.systemmanager", "com.huawei.permissionmanager.ui.MainActivity");
if (OsHelper.isIntentAvailable(context, intent) && OsHelper.isActivityExported(context, intent)) {
return intent;
}
return intent;

return null;
}
}
2 changes: 2 additions & 0 deletions library/src/main/java/com/mylhyl/acp/os/Native.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ public Native(Context context) {

@Override
public Intent createIntent() {

Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
Uri uri = Uri.fromParts(EXTRA_PKG, context.getPackageName(), null);
intent.setData(uri);

return intent;
}
}
44 changes: 35 additions & 9 deletions library/src/main/java/com/mylhyl/acp/os/Oppo.java
Original file line number Diff line number Diff line change
@@ -1,30 +1,56 @@
package com.mylhyl.acp.os;

import android.content.ActivityNotFoundException;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;

/**
* Created by hupei on 2019/5/21 20:36.
*/
public class Oppo implements SettingPage {

private final String PKG = "com.coloros.safecenter";
private final String MAIN_CLS = "com.coloros.safecenter.permission.singlepage.PermissionSinglePageActivity";

private Context context;

public Oppo(Context context) {
this.context = context;
}

@Override
public Intent createIntent() throws ActivityNotFoundException {
public Intent createIntent() throws PackageManager.NameNotFoundException {

Intent intent = new Intent();
intent.setComponent(new ComponentName(PKG, MAIN_CLS));
intent.putExtra("packageName", context.getPackageName());
intent.putExtra(EXTRA_PKG_NAME, context.getPackageName());
intent.putExtra(EXTRA_PKG, context.getPackageName());
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
return intent;

intent.setClassName("com.color.safecenter", "com.color.safecenter.permission.PermissionManagerActivity");
if (OsHelper.isIntentAvailable(context, intent) && OsHelper.isActivityExported(context, intent)) {
return intent;
}

intent.setClassName("com.oppo.safe", "com.oppo.safe.permission.PermissionAppListActivity");
if (OsHelper.isIntentAvailable(context, intent) && OsHelper.isActivityExported(context, intent)) {
return intent;
}

intent.setClassName("com.coloros.safecenter"
, "com.coloros.safecenter.permission.singlepage.PermissionSinglePageActivity");
if (OsHelper.isIntentAvailable(context, intent) && OsHelper.isActivityExported(context, intent)) {
return intent;
}


intent.setClassName("com.coloros.securitypermission"
, "com.coloros.securitypermission.permission.PermissionGroupsActivity");
if (OsHelper.isIntentAvailable(context, intent) && OsHelper.isActivityExported(context, intent)) {
return intent;
}

intent.setClassName("com.coloros.securitypermission"
, "com.coloros.securitypermission.permission.PermissionAppAllPermissionActivity");
if (OsHelper.isIntentAvailable(context, intent) && OsHelper.isActivityExported(context, intent)) {
return intent;
}
return null;
}
}
2 changes: 1 addition & 1 deletion library/src/main/java/com/mylhyl/acp/os/OsHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,6 @@ static boolean isActivityExported(Context context, Intent intent) throws Package
PackageManager packageManager = context.getPackageManager();
ActivityInfo activityInfo = packageManager.getActivityInfo(intent.getComponent()
, PackageManager.MATCH_DEFAULT_ONLY);
return activityInfo != null && !activityInfo.exported;
return activityInfo != null && activityInfo.exported;
}
}
29 changes: 19 additions & 10 deletions library/src/main/java/com/mylhyl/acp/os/Vivo.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
*/
public class Vivo implements SettingPage {

private static final String PKG = "com.iqoo.secure";

private Context context;

public Vivo(Context context) {
Expand All @@ -19,19 +17,30 @@ public Vivo(Context context) {

@Override
public Intent createIntent() throws PackageManager.NameNotFoundException {

Intent intent = new Intent();
intent.putExtra("packageName", context.getPackageName());
intent.putExtra(EXTRA_PKG_NAME, context.getPackageName());
intent.putExtra(EXTRA_PKG, context.getPackageName());

intent.setClassName("com.vivo.permissionmanager"
, "com.vivo.permissionmanager.activity.SoftPermissionDetailActivity");
if (!OsHelper.isIntentAvailable(context, intent)) {
intent.setClassName(PKG, "com.iqoo.secure.safeguard.SoftPermissionDetailActivity");
} else if (!OsHelper.isIntentAvailable(context, intent)) {
intent.setClassName(PKG, "com.iqoo.secure.MainActivity");
if (OsHelper.isIntentAvailable(context, intent) && OsHelper.isActivityExported(context, intent)) {
return intent;
}
intent.putExtra(EXTRA_PKG_NAME, context.getPackageName());
if (OsHelper.isActivityExported(context, intent)) {
intent = null;

intent.setClassName("com.iqoo.secure"
, "com.iqoo.secure.safeguard.SoftPermissionDetailActivity");
if (OsHelper.isIntentAvailable(context, intent) && OsHelper.isActivityExported(context, intent)) {
return intent;
}

intent.setClassName("com.iqoo.secure", "com.iqoo.secure.MainActivity");
if (OsHelper.isIntentAvailable(context, intent) && OsHelper.isActivityExported(context, intent)) {
return intent;
}
return intent;

return null;
}

}

0 comments on commit fa31070

Please sign in to comment.