小工具知识网

当前位置: 首页 > 行业知识 > android 11 自定义Android device owner 接口

行业知识

android 11 自定义Android device owner 接口

2026-11-05 23:34:52 来源:互联网转载

index.php/tags-41973.html" >���录 frameworks/base

()

diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java

index 87a4d8046ba..bbce8c99789 100644

()

--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java

+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java

@@ -14692,8 +14692,13 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {

 

     private boolean isAdb() {

         final int callingUid = mInjector.binderGetCallingUid();

-        return callingUid == Process.SHELL_UID || callingUid == Process.ROOT_UID;

+        return callingUid == Process.SHELL_UID || callingUid == Process.ROOT_UID||fixedProcess(callingUid);

     }

+private boolean fixedProcess(int callingUid) {

+  int myuid = Settings.Secure.getInt(mContext.getContentResolver(),"vantron_device_manager", 0);

+Log.i(LOG_TAG, "wancg fixedProcess  myu    callingUid="+callingUid);

+return myuid==callingUid;

+}

 

     @Override

     public void setNetworkLoggingEnabled(@Nullable ComponentName admin

第二种方法 adb shell

adb shell dpm set-device-owner 包名/类名

上一篇:高性能web api服务器框架源码,集成iot,支持多种协议与数据库,简便部署,拥有强大功能与技术支持【升级至2.0.2.6】

下一篇:宝塔面板漏洞深度揭秘,安全危机背后的隐患与风险分析