|
|
@@ -26,6 +26,12 @@ import android.view.Gravity;
|
|
|
import android.view.View;
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
+import com.allen.android.lib.rom.HuaweiUtils;
|
|
|
+import com.allen.android.lib.rom.MeizuUtils;
|
|
|
+import com.allen.android.lib.rom.MiuiUtils;
|
|
|
+import com.allen.android.lib.rom.OppoUtils;
|
|
|
+import com.allen.android.lib.rom.QikuUtils;
|
|
|
+import com.allen.android.lib.rom.RomUtils;
|
|
|
import com.bumptech.glide.Glide;
|
|
|
import com.bumptech.glide.load.engine.cache.InternalCacheDiskCacheFactory;
|
|
|
import com.kfzs.duanduan.utils.ApkUtils;
|
|
|
@@ -795,46 +801,37 @@ public class SysAppUtil {
|
|
|
/**
|
|
|
* 启动应用的设置
|
|
|
*/
|
|
|
- public static void startAppSettings(Activity activity) {
|
|
|
-// Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
|
|
-// intent.setData(Uri.parse("package:" + BuildConfig.APPLICATION_ID));
|
|
|
-// activity.startActivity(intent);
|
|
|
- // vivo 点击设置图标>加速白名单>我的app
|
|
|
- // 点击软件管理>软件管理权限>软件>我的app>信任该软件
|
|
|
- Intent appIntent = activity.getPackageManager().getLaunchIntentForPackage("com.iqoo.secure");
|
|
|
- if(appIntent != null){
|
|
|
- activity.startActivity(appIntent);
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- // oppo 点击设置图标>应用权限管理>按应用程序管理>我的app>我信任该应用
|
|
|
- // 点击权限隐私>自启动管理>我的app
|
|
|
- appIntent = activity.getPackageManager().getLaunchIntentForPackage("com.oppo.safe");
|
|
|
- if(appIntent != null){
|
|
|
- activity.startActivity(appIntent);
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- Intent intent = new Intent();
|
|
|
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
|
- intent.setAction(Settings.ACTION_APP_NOTIFICATION_SETTINGS);
|
|
|
- intent.putExtra(Settings.EXTRA_APP_PACKAGE, activity.getPackageName());
|
|
|
- } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
|
|
- intent.setAction(Settings.ACTION_APP_NOTIFICATION_SETTINGS);
|
|
|
- intent.putExtra("app_package", activity.getPackageName());
|
|
|
- intent.putExtra("app_uid", activity.getApplicationInfo().uid);
|
|
|
- } else if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD){
|
|
|
- intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
|
- intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
|
|
- intent.setData(Uri.fromParts("package", activity.getPackageName(), null));
|
|
|
+ public static void startAppSettings(Activity activity) throws NoSuchFieldException, IllegalAccessException {
|
|
|
+ SheepApp context = SheepApp.getInstance();
|
|
|
+ if (Build.VERSION.SDK_INT < 23) {
|
|
|
+ if (RomUtils.checkIsMiuiRom()) {
|
|
|
+ MiuiUtils.applyMiuiPermission(context);
|
|
|
+ } else if (RomUtils.checkIsMeizuRom()) {
|
|
|
+ MeizuUtils.applyPermission(context);
|
|
|
+ } else if (RomUtils.checkIsHuaweiRom()) {
|
|
|
+ HuaweiUtils.applyPermission(context);
|
|
|
+ } else if (RomUtils.checkIs360Rom()) {
|
|
|
+ QikuUtils.applyPermission(context);
|
|
|
+ } else if (RomUtils.checkIsOppoRom()) {
|
|
|
+ OppoUtils.applyOppoPermission(context);
|
|
|
+ } else {
|
|
|
+ RomUtils.getAppDetailSettingIntent(context);
|
|
|
+ }
|
|
|
} else {
|
|
|
- intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
|
- intent.setAction(Intent.ACTION_VIEW);
|
|
|
- intent.setClassName("com.android.settings","com.android.settings.InstalledAppDetails");
|
|
|
- intent.putExtra("com.android.settings.ApplicationPkgName", activity.getPackageName());
|
|
|
+ if (RomUtils.checkIsMeizuRom()) {
|
|
|
+ MeizuUtils.applyPermission(context);
|
|
|
+ } else {
|
|
|
+ if (RomUtils.checkIsOppoRom() || RomUtils.checkIsVivoRom()
|
|
|
+ || RomUtils.checkIsHuaweiRom() || RomUtils.checkIsSamsunRom()) {
|
|
|
+ RomUtils.getAppDetailSettingIntent(context);
|
|
|
+ } else if (RomUtils.checkIsMiuiRom()) {
|
|
|
+ MiuiUtils.toPermisstionSetting(context);
|
|
|
+ } else {
|
|
|
+ RomUtils.commonROMPermissionApplyInternal(context);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- activity.startActivity(intent);
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
|
|
@@ -884,7 +881,19 @@ public class SysAppUtil {
|
|
|
//展示提示框
|
|
|
private static void showShortcutTip(Activity activity) {
|
|
|
ViewUtil.showMsgDialog(activity, new DialogConfig().setTitle("已尝试添加有范商城到桌面").setMsg("若添加失败,请前往系统设置为小绵羊打开\"创建桌面快捷方式\"的权限")
|
|
|
- .setBtnLeftText("取消").setBtnRightText("前往设置").setBtnRightOnClickListener(view -> startAppSettings(activity)));
|
|
|
+ .setBtnLeftText("取消").setBtnRightText("前往设置").setBtnRightOnClickListener(view -> {
|
|
|
+ try {
|
|
|
+ startAppSettings(activity);
|
|
|
+ } catch (NoSuchFieldException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ if(TestUtil.isDev())
|
|
|
+ G.showToast(e);
|
|
|
+ } catch (IllegalAccessException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ if(TestUtil.isDev())
|
|
|
+ G.showToast(e);
|
|
|
+ }
|
|
|
+ }));
|
|
|
}
|
|
|
|
|
|
class CallBackReceiver extends BroadcastReceiver {
|