android 360卫士跳转权限页面如何实现,奇酷360 手机中怎么跳转安全中心中指定包名App的权限管理页面...

我是一名程序员,在

MIUI

中,涉及浮窗的

APP

需要在对应的软件设置页面打开

浮窗权限

才能正常使用

APP

MIUI

的权限设置入口就在应用管理页面,可以通过如下的代码跳转至该入口:

private IntentgetAppDetailSettingIntent(Context context) {

Intent localIntent = new Intent();

localIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

if (Build.VERSION.SDK_INT >= 9) {

localIntent.setAction("android.settings.APPLICATION_DETAILS_SETTINGS");

localIntent.setData(Uri.fromParts("package", getPackageName(),null));

} else if (Build.VERSION.SDK_INT <= 8) {

localIntent.setAction(Intent.ACTION_VIEW);

localIntent.setClassName("com.android.settings","com.android.settings.InstalledAppDetails");

localIntent.putExtra("com.android.settings.ApplicationPkgName", getPackageName());

}

return localIntent;

}

但是在奇酷360手机中,这段代码确实可以跳转至“应用管理”页面,但是应用管理页面中的 权限管理的入口是 置灰的,无法点击。:

0818b9ca8b590ca3270a3433284dd417.png

而且Android自带的任何Action 都不发正确跳转至“权限”的页面。

研究了下,这款手机权限管理的正确进入方式为:(操作流程为:设置-->应用权限管理-->权限管理-->按软件查看)

我玩了下手机,发现手机中有一款内置的App ,名为“安全中心”, 这款App打开后,有个入口也叫权限管理,进去后,如图所示:

0818b9ca8b590ca3270a3433284dd417.png

操作流程为:

安全中心-->权限管理-->按软件查看

随意点击一个App后进入到真正的“权限管理”页面:

0818b9ca8b590ca3270a3433284dd417.png

并且我发现一个现象:

1.  从设置进去的权限管理页面 在跳转的时候有明显的卡顿,在同款App内部进行跳转的时候,除非在onCreate 、onPostCreate、onStar等生命周期涉及到的方法中进行耗时操作,才有可能导致Activity 启动卡顿

2.  但是从“安全中心” App进去权限管理的页面,却不会卡顿

所以我有理由相信这是在设置中进行对 “安全中心”这款App “权限管理" 页面的跳转,于是我遍历了下手机中所有的App的应用信息,发现“安全中心”的包名为:“

com.qihoo360.mobilesafe”,

接着我用下面的方法找到这款App的入口Activity 的ClassName 为:“

com.qihoo360.mobilesafe.ui.index.AppEnterActivity”

Intent resolveIntent = new Intent();

resolveIntent.addCategory(Intent.CATEGORY_DEFAULT);

resolveIntent.setPackage(pi.packageName);

List apps = getPackageManager().queryIntentActivities(resolveIntent,0);

ResolveInfo ri = apps.iterator().next();

for (int i = 0; i < apps.size(); i++) {

ResolveInfo ri = apps.get(i);

System.out.println("packageName:" + ri.activityInfo.packageName +" className: " + ri.activityInfo.name);

}

/**

下面的代码可以跳转至这个APP的入口Activity

if (ri != null ) {

String packageName = ri.activityInfo.packageName;

String className = ri.activityInfo.name;

Intent intent = new Intent(Intent.ACTION_MAIN);

intent.addCategory(Intent.CATEGORY_LAUNCHER);

ComponentName cn = new ComponentName(packageName, className);

intent.setComponent(cn);

startActivity(intent);

}

如果只是想跳转至这个APP的入口Activity,可以更简单:

Intent intent = new Intent();

intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

intent = getPackageManager().getLaunchIntentForPackage("com.qihoo360.mobilesafe");

startActivity(intent);

*/

但只是找到入口远远不够,我需要找到“权限管理”页面,于是我通过下面的Adb命令找到了"权限管理"页面所在的Activity的ClassName为: “

com.qihoo360.mobilesafe.loader.a.ActivityN1NR0”

1.logcat

.清除logcat内容,使用命令adblogcat -c

.启动logcat,使用命令adblogcat ActivityManager:I *:s

.启动要查看的程序,

0818b9ca8b590ca3270a3433284dd417.png

2.dumpsys

(1)启动要查看的程序;

(2)命令行输入:adb shell dumpsys windoww |findstr \/ |findstr name=

0818b9ca8b590ca3270a3433284dd417.png

做完上述操作的第一步之后,点击“安全中心” ,进入到这个App,一步步点击到“权限管理”页面。操作流程为: 安全中心App-->权限管理-->按软件查看.

做到这里, 我希望跳转至这个Activity:

ActivityN1NR0,我想反编译这个“安全中心”App的代码看看跳转的代码,所以我想root后去

/system目录下找这个app的 apk包。

我尝试root :失败。 使用root工具: 失败。

我换了种方式,直接通过文件流把这个APP的apk包复制出来也行啊,如下所示:

try {

ApplicationInfo appInfo =getPackageManager().getApplicationInfo("com.qihoo360.mobilesafe", 0);

String apkPath = appInfo.sourceDir;

if (TextUtils.isEmpty(apkPath)) {

return;

}

FileInputStream fileInputStream = new FileInputStream(apkPath);

File cacheFile = new File(Environment.getExternalStorageDirectory().toString()+ File.separator + "360safe.apk");

if(!cacheFile.exists()) {

cacheFile.createNewFile();

}

BufferedOutputStream bos = null;

bos = new BufferedOutputStream(new FileOutputStream(cacheFile));

byte[] buf = new byte[1024];

int len = 0;

while ((len = fileInputStream.read(buf)) > 0) {

bos.write(buf, 0, len);

}

fileInputStream.close();

bos.close();

} catch (Exception e) {

e.printStackTrace();

}

复制成功,但是悲剧了,我zip解压后,发现没有

classes.dex文件,都在assect中,如图所示:

0818b9ca8b590ca3270a3433284dd417.png

0818b9ca8b590ca3270a3433284dd417.png

AndroidMnifest.xml中找到了Activity:

ActivityN1NR0

0818b9ca8b590ca3270a3433284dd417.png

至此,是我全部的过程,

还是没有找到跳转至

权限管理

页面的

方法。

后续寻找方法中!!!

360论坛发帖地址:点击打开链接

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值