<accessibility-service xmlns:android="http://schemas.android.com/apk/res/android" android:accessibilityEventTypes="typeWindowStateChanged" android:accessibilityFeedbackType="feedbackGeneric" android:accessibilityFlags="flagDefault" android:canRetrieveWindowContent="true" android:description="@string/desc" android:notificationTimeout="100" android:packageNames="com.android.packageinstaller,com.miui.packageinstaller,com.android.packageinstaller/.FlymePackageInstallerActivity" />
performGlobalAction(GLOBAL_ACTION_BACK);
private void processAccessibilityEnvent(AccessibilityEvent event) {
String[] phoneAttrs = AppUtil.getPhoneAttrs();
if (event.getSource() != null && TextUtils.equals(event.getClassName(), phoneAttrs[0]))
{
try {
Thread.sleep(3000);
} catch (InterruptedException e)
{
e.printStackTrace();
}
//获取应用名称 String app_name = findViewContentByID(phoneAttrs[1]);
Log.d("xag", "app_name:" + app_name);
//是否存在保留应用中 boolean isExist = false;
if (selectedApps != null && 0 < selectedApps.size())
{
for (AppBean appBean : selectedApps)
{
if (TextUtils.equals(appBean.getApp_name(), app_name))
{
isExist = true;
}
}
}
//如果不在保留应用列表,就不容许安装 if (!isExist)
{
Log.d("xag", "不在保留应用列表,不容许安装!");
performBackClick();
} else {
Log.d("xag", "在保留应用列表,容许安装!");
}
}
}
获取更多资讯请加入交流群
版权说明
本文地址:http://dufengvip.cn/post-226.html
未标注转载均为本站远程,转载请注明文章出处:
pony 2020-01-28 16:33回复
#1
牛皮,回头给我家老爷子安装个 [F1]
李宗樺 2020-01-28 16:37回复
@pony:给老人家个老人机就行了
pony 2020-01-28 16:39回复
@李宗樺:那怎么行
评论列表