[九鼎RK3399Pro] Android 8.1添加一个系统服务

很多时候需要在系统里面开一个服务,为某些App提供特殊的支持。
所以记一下在系统里面添加服务器的基本套路。方便以后做参考。

文章是参考别人的,今天正好翻到这段代码,但是记不起来,在哪里参考的。

diff --git a/frameworks/base/Android.mk b/frameworks/base/Android.mk
index 3018c4e..555267d 100755
--- a/frameworks/base/Android.mk
+++ b/frameworks/base/Android.mk
@@ -558,6 +558,7 @@ LOCAL_SRC_FILES += \
 	packages/services/Proxy/com/android/net/IProxyPortListener.aidl \
 	core/java/android/service/quicksettings/IQSService.aidl \
 	core/java/android/service/quicksettings/IQSTileService.aidl \
+	core/java/android/security/ISecurityServer.aidl \
 
 # The following are native binders that need to go with the native component
 # at system/update_engine/binder_bindings/. Use relative path to refer to them.
diff --git a/frameworks/base/api/current.txt b/frameworks/base/api/current.txt
index b212b70..a9bec71 100644
--- a/frameworks/base/api/current.txt
+++ b/frameworks/base/api/current.txt
@@ -36789,6 +36789,22 @@ package android.sax {
 
 package android.security {
 
+  public class CnbotSecurityManager {
+    ctor public CnbotSecurityManager(android.security.ISecurityServer);
+    method public java.lang.String runCmd(java.lang.String);
+  }
+
+  public abstract interface ISecurityServer implements android.os.IInterface {
+    method public abstract java.lang.String runCmd(java.lang.String) throws android.os.RemoteException;
+  }
+
+  public static abstract class ISecurityServer.Stub extends android.os.Binder implements android.security.ISecurityServer {
+    ctor public ISecurityServer.Stub();
+    method public android.os.IBinder asBinder();
+    method public static android.security.ISecurityServer asInterface(android.os.IBinder);
+    method public boolean onTransact(int, android.os.Parcel, android.os.Parcel, int) throws android.os.RemoteException;
+  }
+
   public final class KeyChain {
     ctor public KeyChain();
     method public static void choosePrivateKeyAlias(android.app.Activity, android.security.KeyChainAliasCallback, java.lang.String[], java.security.Principal[], java.lang.String, int, java.lang.String);
diff --git a/frameworks/base/api/system-current.txt b/frameworks/base/api/system-current.txt
index cd46c4c..0cedf26 100644
--- a/frameworks/base/api/system-current.txt
+++ b/frameworks/base/api/system-current.txt
@@ -39866,6 +39866,22 @@ package android.sax {
 
 package android.security {
 
+  public class CnbotSecurityManager {
+    ctor public CnbotSecurityManager(android.security.ISecurityServer);
+    method public java.lang.String runCmd(java.lang.String);
+  }
+
+  public abstract interface ISecurityServer implements android.os.IInterface {
+    method public abstract java.lang.String runCmd(java.lang.String) throws android.os.RemoteException;
+  }
+
+  public static abstract class ISecurityServer.Stub extends android.os.Binder implements android.security.ISecurityServer {
+    ctor public ISecurityServer.Stub();
+    method public android.os.IBinder asBinder();
+    method public static android.security.ISecurityServer asInterface(android.os.IBinder);
+    method public boolean onTransact(int, android.os.Parcel, android.os.Parcel, int) throws android.os.RemoteException;
+  }
+
   public final class KeyChain {
     ctor public KeyChain();
     method public static void choosePrivateKeyAlias(android.app.Activity, android.security.KeyChainAliasCallback, java.lang.String[], java.security.Principal[], java.lang.String, int, java.lang.String);
diff --git a/frameworks/base/api/test-current.txt b/frameworks/base/api/test-current.txt
index f366576..ab40834 100644
--- a/frameworks/base/api/test-current.txt
+++ b/frameworks/base/api/test-current.txt
@@ -36986,6 +36986,22 @@ package android.sax {
 
 package android.security {
 
+  public class CnbotSecurityManager {
+    ctor public CnbotSecurityManager(android.security.ISecurityServer);
+    method public java.lang.String runCmd(java.lang.String);
+  }
+
+  public abstract interface ISecurityServer implements android.os.IInterface {
+    method public abstract java.lang.String runCmd(java.lang.String) throws android.os.RemoteException;
+  }
+
+  public static abstract class ISecurityServer.Stub extends android.os.Binder implements android.security.ISecurityServer {
+    ctor public ISecurityServer.Stub();
+    method public android.os.IBinder asBinder();
+    method public static android.security.ISecurityServer asInterface(android.os.IBinder);
+    method public boolean onTransact(int, android.os.Parcel, android.os.Parcel, int) throws android.os.RemoteException;
+  }
+
   public final class KeyChain {
     ctor public KeyChain();
     method public static void choosePrivateKeyAlias(android.app.Activity, android.security.KeyChainAliasCallback, java.lang.String[], java.security.Principal[], java.lang.String, int, java.lang.String);
diff --git a/frameworks/base/core/java/android/app/SystemServiceRegistry.java b/frameworks/base/core/java/android/app/SystemServiceRegistry.java
index e695936..657c059 100755
--- a/frameworks/base/core/java/android/app/SystemServiceRegistry.java
+++ b/frameworks/base/core/java/android/app/SystemServiceRegistry.java
@@ -904,10 +904,19 @@ final class SystemServiceRegistry {
 
         registerService(Context.TIME_ZONE_RULES_MANAGER_SERVICE, RulesManager.class,
                 new CachedServiceFetcher<RulesManager>() {
-            @Override
+	    @Override
             public RulesManager createService(ContextImpl ctx) {
                 return new RulesManager(ctx.getOuterContext());
             }});
+	//添加Cnbot服务
+		registerService("cnbot_service", android.security.CnbotSecurityManager.class,
+			new CachedServiceFetcher<android.security.CnbotSecurityManager>() {
+       	    @Override
+			public android.security.CnbotSecurityManager createService(ContextImpl ctx) {
+				IBinder b = ServiceManager.getService("cnbot_service");
+				return new android.security.CnbotSecurityManager(android.security.ISecurityServer.Stub.asInterface(b));
+			}
+		});
     }
 
     /**
diff --git a/frameworks/base/core/java/android/security/CnbotSecurityManager.java b/frameworks/base/core/java/android/security/CnbotSecurityManager.java
new file mode 100644
index 0000000..9dfffa5
--- /dev/null
+++ b/frameworks/base/core/java/android/security/CnbotSecurityManager.java
@@ -0,0 +1,25 @@
+
+package android.security;
+
+//import java.io.Exception;
+import android.util.Log;
+
+public class CnbotSecurityManager{
+	private final ISecurityServer mService;
+	public CnbotSecurityManager(ISecurityServer service){
+		mService = service;
+	}
+	
+	public String runCmd(String cmd){
+		Log.d("CnbotSecurityManager","接到指令:"+cmd);
+		try{
+			return mService.runCmd(cmd);
+		}catch(Exception e){
+			Log.d("CnbotSecurityManager","runCmd faild");
+			return "error";
+		}
+	}
+
+
+    
+}
diff --git a/frameworks/base/core/java/android/security/ISecurityServer.aidl b/frameworks/base/core/java/android/security/ISecurityServer.aidl
new file mode 100644
index 0000000..42ac465
--- /dev/null
+++ b/frameworks/base/core/java/android/security/ISecurityServer.aidl
@@ -0,0 +1,5 @@
+package android.security;
+
+interface ISecurityServer {
+	String runCmd(String cmd);
+}
diff --git a/frameworks/base/services/core/java/com/android/server/ProcessModel.java b/frameworks/base/services/core/java/com/android/server/ProcessModel.java
new file mode 100755
index 0000000..e5df6df
--- /dev/null
+++ b/frameworks/base/services/core/java/com/android/server/ProcessModel.java
@@ -0,0 +1,199 @@
+package com.android.server;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+
+/**
+ * Create By Qiujuer
+ * 2014-07-26
+ * <p/>
+ * 执行命令行语句静态方法封装
+ */
+public class ProcessModel {
+    //换行符
+    private static final String BREAK_LINE;
+    //执行退出命令
+    private static final byte[] COMMAND_EXIT;
+    //错误缓冲
+    private static byte[] BUFFER;
+
+    /**
+     * 静态变量初始化
+     */
+    static {
+        BREAK_LINE = "\n";
+        COMMAND_EXIT = "\nexit\n".getBytes();
+        BUFFER = new byte[32];
+    }
+
+
+    /**
+     * 执行命令
+     *
+     * @param params 命令参数
+     *               <pre> eg: "/system/bin/ping", "-c", "4", "-s", "100","www.qiujuer.net"</pre>
+     * @return 执行结果
+     */
+    public static String execute(String... params) {
+        Process process = null;
+        StringBuilder sbReader = null;
+
+        BufferedReader bReader = null;
+        InputStreamReader isReader = null;
+
+        InputStream in = null;
+        InputStream err = null;
+        OutputStream out = null;
+
+        try {
+            process = new ProcessBuilder()
+                    .command(params)
+                    .start();
+            out = process.getOutputStream();
+            in = process.getInputStream();
+            err = process.getErrorStream();
+
+            out.write(COMMAND_EXIT);
+            out.flush();
+
+            process.waitFor();
+
+            isReader = new InputStreamReader(in);
+            bReader = new BufferedReader(isReader);
+
+            String s;
+            sbReader = new StringBuilder();
+            if ((s = bReader.readLine()) != null) {
+                sbReader.append(s);
+                sbReader.append(BREAK_LINE);
+                while ((s = bReader.readLine()) != null) {
+                    sbReader.append(s);
+                    sbReader.append(BREAK_LINE);
+                }
+            }
+
+            while ((err.read(BUFFER)) > 0) {
+                sbReader.append(new String(BUFFER));
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            closeAllStream(out, err, in, isReader, bReader);
+
+            if (process != null) {
+                processDestroy(process);
+                process = null;
+            }
+        }
+
+        if (sbReader == null)
+            return null;
+        else
+            return sbReader.toString();
+    }
+
+    /**
+     * 关闭所有流
+     *
+     * @param out      输出流
+     * @param err      错误流
+     * @param in       输入流
+     * @param isReader 输入流封装
+     * @param bReader  输入流封装
+     */
+    private static void closeAllStream(OutputStream out, InputStream err, InputStream in, InputStreamReader isReader, BufferedReader bReader) {
+        if (out != null)
+            try {
+                out.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        if (err != null)
+            try {
+                err.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        if (in != null)
+            try {
+                in.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        if (isReader != null)
+            try {
+                isReader.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        if (bReader != null)
+            try {
+                bReader.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+    }
+
+
+    /**
+     * 通过Android底层实现进程关闭
+     *
+     * @param process 进程
+     */
+    private static void killProcess(Process process) {
+        int pid = getProcessId(process);
+        if (pid != 0) {
+            try {
+                //android kill process
+                android.os.Process.killProcess(pid);
+            } catch (Exception e) {
+                try {
+                    process.destroy();
+                } catch (Exception ex) {
+                }
+            }
+        }
+    }
+
+    /**
+     * 获取进程的ID
+     *
+     * @param process 进程
+     * @return
+     */
+    private static int getProcessId(Process process) {
+        String str = process.toString();
+        try {
+            int i = str.indexOf("=") + 1;
+            int j = str.indexOf("]");
+            str = str.substring(i, j);
+            return Integer.parseInt(str);
+        } catch (Exception e) {
+            return 0;
+        }
+    }
+
+    /**
+     * 销毁进程
+     *
+     * @param process 进程
+     */
+    private static void processDestroy(Process process) {
+        if (process != null) {
+            try {
+                //判断是否正常退出
+                if (process.exitValue() != 0) {
+                    killProcess(process);
+                }
+            } catch (IllegalThreadStateException e) {
+                killProcess(process);
+            }
+        }
+    }
+}
+
diff --git a/frameworks/base/services/core/java/com/android/server/SecurityServer.java b/frameworks/base/services/core/java/com/android/server/SecurityServer.java
new file mode 100644
index 0000000..d321531
--- /dev/null
+++ b/frameworks/base/services/core/java/com/android/server/SecurityServer.java
@@ -0,0 +1,41 @@
+package com.android.server;
+
+import android.security.ISecurityServer;
+import android.util.Log;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import android.os.Handler;
+
+public class SecurityServer extends ISecurityServer.Stub{
+
+    Handler handler = new Handler();
+    @Override
+    public String runCmd(String cmd) {
+	Runnable runnable = new Runnable() {
+            @Override
+            public void run() {
+		try{
+                	Log.d("SecurityServer",ProcessModel.execute(cmd.split(" ")));
+		}catch(Exception e){
+			e.printStackTrace();
+		}
+		
+            }
+        };
+	handler.post(runnable);
+        //new Thread(runnable).start();
+	//checkPermission(cmd);
+	try {
+               Thread.sleep(500);
+        } catch (InterruptedException e) {
+                    e.printStackTrace();
+        }
+	return "hello word";
+    }
+
+
+   
+
+}
+
diff --git a/frameworks/base/services/java/com/android/server/SystemServer.java b/frameworks/base/services/java/com/android/server/SystemServer.java
index 0ea9f17..d03c1f8 100755
--- a/frameworks/base/services/java/com/android/server/SystemServer.java
+++ b/frameworks/base/services/java/com/android/server/SystemServer.java
@@ -880,6 +880,9 @@ public final class SystemServer {
             mSystemServiceManager.startService(IpConnectivityMetrics.class);
             traceEnd();
 
+	    SecurityServer securityServer = new SecurityServer();
+            ServiceManager.addService("cnbot_service", securityServer);
+
             traceBeginAndSlog("PinnerService");
             mSystemServiceManager.startService(PinnerService.class);
             traceEnd();
diff --git a/system/sepolicy/prebuilts/api/26.0/nonplat_sepolicy.cil b/system/sepolicy/prebuilts/api/26.0/nonplat_sepolicy.cil
index 2ed4efa..567ec49 100644
--- a/system/sepolicy/prebuilts/api/26.0/nonplat_sepolicy.cil
+++ b/system/sepolicy/prebuilts/api/26.0/nonplat_sepolicy.cil
@@ -17,11 +17,11 @@
 (typeattributeset property_type (asan_reboot_prop_26_0 audio_prop_26_0 boottime_prop_26_0 bluetooth_prop_26_0 config_prop_26_0 cppreopt_prop_26_0 ctl_bootanim_prop_26_0 ctl_bugreport_prop_26_0 ctl_console_prop_26_0 ctl_default_prop_26_0 ctl_dumpstate_prop_26_0 ctl_fuse_prop_26_0 ctl_mdnsd_prop_26_0 ctl_rildaemon_prop_26_0 dalvik_prop_26_0 debuggerd_prop_26_0 debug_prop_26_0 default_prop_26_0 device_logging_prop_26_0 dhcp_prop_26_0 dumpstate_options_prop_26_0 dumpstate_prop_26_0 ffs_prop_26_0 fingerprint_prop_26_0 firstboot_prop_26_0 hwservicemanager_prop_26_0 logd_prop_26_0 logpersistd_logging_prop_26_0 log_prop_26_0 log_tag_prop_26_0 mmc_prop_26_0 net_dns_prop_26_0 net_radio_prop_26_0 nfc_prop_26_0 overlay_prop_26_0 pan_result_prop_26_0 persist_debug_prop_26_0 persistent_properties_ready_prop_26_0 powerctl_prop_26_0 radio_prop_26_0 restorecon_prop_26_0 safemode_prop_26_0 serialno_prop_26_0 shell_prop_26_0 system_prop_26_0 system_radio_prop_26_0 vold_prop_26_0 wifi_log_prop_26_0 wifi_prop_26_0))
 (typeattributeset core_property_type (audio_prop_26_0 config_prop_26_0 cppreopt_prop_26_0 dalvik_prop_26_0 debuggerd_prop_26_0 debug_prop_26_0 default_prop_26_0 dhcp_prop_26_0 dumpstate_prop_26_0 ffs_prop_26_0 fingerprint_prop_26_0 logd_prop_26_0 net_radio_prop_26_0 nfc_prop_26_0 pan_result_prop_26_0 persist_debug_prop_26_0 powerctl_prop_26_0 radio_prop_26_0 restorecon_prop_26_0 shell_prop_26_0 system_prop_26_0 system_radio_prop_26_0 vold_prop_26_0))
 (typeattributeset log_property_type (log_prop_26_0 log_tag_prop_26_0 wifi_log_prop_26_0))
-(typeattributeset system_server_service (accessibility_service_26_0 account_service_26_0 activity_service_26_0 alarm_service_26_0 appops_service_26_0 appwidget_service_26_0 assetatlas_service_26_0 audio_service_26_0 autofill_service_26_0 backup_service_26_0 batterystats_service_26_0 battery_service_26_0 bluetooth_manager_service_26_0 cameraproxy_service_26_0 clipboard_service_26_0 contexthub_service_26_0 IProxyService_service_26_0 commontime_management_service_26_0 companion_device_service_26_0 connectivity_service_26_0 connmetrics_service_26_0 consumer_ir_service_26_0 content_service_26_0 country_detector_service_26_0 coverage_service_26_0 cpuinfo_service_26_0 dbinfo_service_26_0 device_policy_service_26_0 deviceidle_service_26_0 device_identifiers_service_26_0 devicestoragemonitor_service_26_0 diskstats_service_26_0 display_service_26_0 font_service_26_0 netd_listener_service_26_0 DockObserver_service_26_0 dreams_service_26_0 dropbox_service_26_0 ethernet_service_26_0 fingerprint_service_26_0 gfxinfo_service_26_0 graphicsstats_service_26_0 hardware_service_26_0 hardware_properties_service_26_0 hdmi_control_service_26_0 input_method_service_26_0 input_service_26_0 imms_service_26_0 ipsec_service_26_0 jobscheduler_service_26_0 launcherapps_service_26_0 location_service_26_0 lock_settings_service_26_0 media_projection_service_26_0 media_router_service_26_0 media_session_service_26_0 meminfo_service_26_0 midi_service_26_0 mount_service_26_0 netpolicy_service_26_0 netstats_service_26_0 network_management_service_26_0 network_score_service_26_0 network_time_update_service_26_0 notification_service_26_0 oem_lock_service_26_0 otadexopt_service_26_0 overlay_service_26_0 package_service_26_0 permission_service_26_0 persistent_data_block_service_26_0 pinner_service_26_0 power_service_26_0 print_service_26_0 processinfo_service_26_0 procstats_service_26_0 recovery_service_26_0 registry_service_26_0 restrictions_service_26_0 rttmanager_service_26_0 samplingprofiler_service_26_0 scheduling_policy_service_26_0 search_service_26_0 sec_key_att_app_id_provider_service_26_0 sensorservice_service_26_0 serial_service_26_0 servicediscovery_service_26_0 settings_service_26_0 shortcut_service_26_0 statusbar_service_26_0 storagestats_service_26_0 task_service_26_0 textclassification_service_26_0 textservices_service_26_0 telecom_service_26_0 trust_service_26_0 tv_input_service_26_0 uimode_service_26_0 updatelock_service_26_0 usagestats_service_26_0 usb_service_26_0 user_service_26_0 vibrator_service_26_0 voiceinteraction_service_26_0 vr_manager_service_26_0 wallpaper_service_26_0 webviewupdate_service_26_0 wifip2p_service_26_0 wifiscanner_service_26_0 wifi_service_26_0 wifiaware_service_26_0 window_service_26_0))
-(typeattributeset app_api_service (batteryproperties_service_26_0 gatekeeper_service_26_0 accessibility_service_26_0 account_service_26_0 activity_service_26_0 alarm_service_26_0 appops_service_26_0 appwidget_service_26_0 assetatlas_service_26_0 audio_service_26_0 autofill_service_26_0 backup_service_26_0 batterystats_service_26_0 bluetooth_manager_service_26_0 clipboard_service_26_0 contexthub_service_26_0 IProxyService_service_26_0 companion_device_service_26_0 connectivity_service_26_0 connmetrics_service_26_0 consumer_ir_service_26_0 content_service_26_0 country_detector_service_26_0 device_policy_service_26_0 deviceidle_service_26_0 device_identifiers_service_26_0 display_service_26_0 font_service_26_0 dreams_service_26_0 dropbox_service_26_0 ethernet_service_26_0 fingerprint_service_26_0 graphicsstats_service_26_0 hardware_properties_service_26_0 input_method_service_26_0 input_service_26_0 imms_service_26_0 ipsec_service_26_0 jobscheduler_service_26_0 launcherapps_service_26_0 location_service_26_0 media_projection_service_26_0 media_router_service_26_0 media_session_service_26_0 midi_service_26_0 mount_service_26_0 netpolicy_service_26_0 netstats_service_26_0 network_management_service_26_0 notification_service_26_0 package_service_26_0 permission_service_26_0 power_service_26_0 print_service_26_0 procstats_service_26_0 registry_service_26_0 restrictions_service_26_0 rttmanager_service_26_0 search_service_26_0 sec_key_att_app_id_provider_service_26_0 sensorservice_service_26_0 servicediscovery_service_26_0 settings_service_26_0 shortcut_service_26_0 statusbar_service_26_0 storagestats_service_26_0 textclassification_service_26_0 textservices_service_26_0 telecom_service_26_0 trust_service_26_0 tv_input_service_26_0 uimode_service_26_0 usagestats_service_26_0 usb_service_26_0 user_service_26_0 vibrator_service_26_0 voiceinteraction_service_26_0 wallpaper_service_26_0 webviewupdate_service_26_0 wifip2p_service_26_0 wifi_service_26_0 wifiaware_service_26_0))
-(typeattributeset ephemeral_app_api_service (batteryproperties_service_26_0 accessibility_service_26_0 account_service_26_0 activity_service_26_0 alarm_service_26_0 appops_service_26_0 appwidget_service_26_0 assetatlas_service_26_0 audio_service_26_0 autofill_service_26_0 backup_service_26_0 batterystats_service_26_0 bluetooth_manager_service_26_0 clipboard_service_26_0 IProxyService_service_26_0 companion_device_service_26_0 connectivity_service_26_0 connmetrics_service_26_0 consumer_ir_service_26_0 content_service_26_0 country_detector_service_26_0 deviceidle_service_26_0 device_identifiers_service_26_0 display_service_26_0 font_service_26_0 dreams_service_26_0 dropbox_service_26_0 graphicsstats_service_26_0 hardware_properties_service_26_0 input_method_service_26_0 input_service_26_0 imms_service_26_0 ipsec_service_26_0 jobscheduler_service_26_0 launcherapps_service_26_0 location_service_26_0 media_projection_service_26_0 media_router_service_26_0 media_session_service_26_0 midi_service_26_0 mount_service_26_0 netpolicy_service_26_0 netstats_service_26_0 network_management_service_26_0 notification_service_26_0 package_service_26_0 permission_service_26_0 power_service_26_0 print_service_26_0 procstats_service_26_0 registry_service_26_0 restrictions_service_26_0 rttmanager_service_26_0 search_service_26_0 sensorservice_service_26_0 servicediscovery_service_26_0 settings_service_26_0 statusbar_service_26_0 storagestats_service_26_0 textclassification_service_26_0 textservices_service_26_0 telecom_service_26_0 tv_input_service_26_0 uimode_service_26_0 usagestats_service_26_0 user_service_26_0 vibrator_service_26_0 voiceinteraction_service_26_0 webviewupdate_service_26_0))
+(typeattributeset system_server_service (accessibility_service_26_0 account_service_26_0 activity_service_26_0 alarm_service_26_0 appops_service_26_0 appwidget_service_26_0 assetatlas_service_26_0 audio_service_26_0 autofill_service_26_0 backup_service_26_0 batterystats_service_26_0 battery_service_26_0 bluetooth_manager_service_26_0 cameraproxy_service_26_0 clipboard_service_26_0 contexthub_service_26_0 IProxyService_service_26_0 commontime_management_service_26_0 companion_device_service_26_0 connectivity_service_26_0 connmetrics_service_26_0 consumer_ir_service_26_0 content_service_26_0 country_detector_service_26_0 coverage_service_26_0 cpuinfo_service_26_0 dbinfo_service_26_0 device_policy_service_26_0 deviceidle_service_26_0 device_identifiers_service_26_0 devicestoragemonitor_service_26_0 diskstats_service_26_0 display_service_26_0 font_service_26_0 netd_listener_service_26_0 DockObserver_service_26_0 dreams_service_26_0 dropbox_service_26_0 ethernet_service_26_0 fingerprint_service_26_0 gfxinfo_service_26_0 graphicsstats_service_26_0 hardware_service_26_0 hardware_properties_service_26_0 hdmi_control_service_26_0 input_method_service_26_0 input_service_26_0 imms_service_26_0 ipsec_service_26_0 jobscheduler_service_26_0 launcherapps_service_26_0 location_service_26_0 lock_settings_service_26_0 media_projection_service_26_0 media_router_service_26_0 media_session_service_26_0 meminfo_service_26_0 midi_service_26_0 mount_service_26_0 netpolicy_service_26_0 netstats_service_26_0 network_management_service_26_0 network_score_service_26_0 network_time_update_service_26_0 notification_service_26_0 oem_lock_service_26_0 otadexopt_service_26_0 overlay_service_26_0 package_service_26_0 permission_service_26_0 persistent_data_block_service_26_0 pinner_service_26_0 power_service_26_0 print_service_26_0 processinfo_service_26_0 procstats_service_26_0 recovery_service_26_0 registry_service_26_0 restrictions_service_26_0 rttmanager_service_26_0 samplingprofiler_service_26_0 scheduling_policy_service_26_0 search_service_26_0 sec_key_att_app_id_provider_service_26_0 sensorservice_service_26_0 serial_service_26_0 servicediscovery_service_26_0 settings_service_26_0 shortcut_service_26_0 statusbar_service_26_0 storagestats_service_26_0 task_service_26_0 textclassification_service_26_0 textservices_service_26_0 telecom_service_26_0 trust_service_26_0 tv_input_service_26_0 uimode_service_26_0 updatelock_service_26_0 usagestats_service_26_0 usb_service_26_0 user_service_26_0 vibrator_service_26_0 voiceinteraction_service_26_0 vr_manager_service_26_0 wallpaper_service_26_0 webviewupdate_service_26_0 wifip2p_service_26_0 wifiscanner_service_26_0 wifi_service_26_0 wifiaware_service_26_0 window_service_26_0 cnbot_service_26_0))
+(typeattributeset app_api_service (batteryproperties_service_26_0 gatekeeper_service_26_0 accessibility_service_26_0 account_service_26_0 activity_service_26_0 alarm_service_26_0 appops_service_26_0 appwidget_service_26_0 assetatlas_service_26_0 audio_service_26_0 autofill_service_26_0 backup_service_26_0 batterystats_service_26_0 bluetooth_manager_service_26_0 clipboard_service_26_0 contexthub_service_26_0 IProxyService_service_26_0 companion_device_service_26_0 connectivity_service_26_0 connmetrics_service_26_0 consumer_ir_service_26_0 content_service_26_0 country_detector_service_26_0 device_policy_service_26_0 deviceidle_service_26_0 device_identifiers_service_26_0 display_service_26_0 font_service_26_0 dreams_service_26_0 dropbox_service_26_0 ethernet_service_26_0 fingerprint_service_26_0 graphicsstats_service_26_0 hardware_properties_service_26_0 input_method_service_26_0 input_service_26_0 imms_service_26_0 ipsec_service_26_0 jobscheduler_service_26_0 launcherapps_service_26_0 location_service_26_0 media_projection_service_26_0 media_router_service_26_0 media_session_service_26_0 midi_service_26_0 mount_service_26_0 netpolicy_service_26_0 netstats_service_26_0 network_management_service_26_0 notification_service_26_0 package_service_26_0 permission_service_26_0 power_service_26_0 print_service_26_0 procstats_service_26_0 registry_service_26_0 restrictions_service_26_0 rttmanager_service_26_0 search_service_26_0 sec_key_att_app_id_provider_service_26_0 sensorservice_service_26_0 servicediscovery_service_26_0 settings_service_26_0 shortcut_service_26_0 statusbar_service_26_0 storagestats_service_26_0 textclassification_service_26_0 textservices_service_26_0 telecom_service_26_0 trust_service_26_0 tv_input_service_26_0 uimode_service_26_0 usagestats_service_26_0 usb_service_26_0 user_service_26_0 vibrator_service_26_0 voiceinteraction_service_26_0 wallpaper_service_26_0 webviewupdate_service_26_0 wifip2p_service_26_0 wifi_service_26_0 wifiaware_service_26_0 cnbot_service_26_0))
+(typeattributeset ephemeral_app_api_service (batteryproperties_service_26_0 accessibility_service_26_0 account_service_26_0 activity_service_26_0 alarm_service_26_0 appops_service_26_0 appwidget_service_26_0 assetatlas_service_26_0 audio_service_26_0 autofill_service_26_0 backup_service_26_0 batterystats_service_26_0 bluetooth_manager_service_26_0 clipboard_service_26_0 IProxyService_service_26_0 companion_device_service_26_0 connectivity_service_26_0 connmetrics_service_26_0 consumer_ir_service_26_0 content_service_26_0 country_detector_service_26_0 deviceidle_service_26_0 device_identifiers_service_26_0 display_service_26_0 font_service_26_0 dreams_service_26_0 dropbox_service_26_0 graphicsstats_service_26_0 hardware_properties_service_26_0 input_method_service_26_0 input_service_26_0 imms_service_26_0 ipsec_service_26_0 jobscheduler_service_26_0 launcherapps_service_26_0 location_service_26_0 media_projection_service_26_0 media_router_service_26_0 media_session_service_26_0 midi_service_26_0 mount_service_26_0 netpolicy_service_26_0 netstats_service_26_0 network_management_service_26_0 notification_service_26_0 package_service_26_0 permission_service_26_0 power_service_26_0 print_service_26_0 procstats_service_26_0 registry_service_26_0 restrictions_service_26_0 rttmanager_service_26_0 search_service_26_0 sensorservice_service_26_0 servicediscovery_service_26_0 settings_service_26_0 statusbar_service_26_0 storagestats_service_26_0 textclassification_service_26_0 textservices_service_26_0 telecom_service_26_0 tv_input_service_26_0 uimode_service_26_0 usagestats_service_26_0 user_service_26_0 vibrator_service_26_0 voiceinteraction_service_26_0 webviewupdate_service_26_0 cnbot_service_26_0))
 (typeattributeset system_api_service (cpuinfo_service_26_0 dbinfo_service_26_0 diskstats_service_26_0 gfxinfo_service_26_0 hdmi_control_service_26_0 lock_settings_service_26_0 meminfo_service_26_0 network_score_service_26_0 oem_lock_service_26_0 persistent_data_block_service_26_0 serial_service_26_0 updatelock_service_26_0 wifiscanner_service_26_0 window_service_26_0))
-(typeattributeset service_manager_type (audioserver_service_26_0 batteryproperties_service_26_0 bluetooth_service_26_0 cameraserver_service_26_0 default_android_service_26_0 drmserver_service_26_0 dumpstate_service_26_0 fingerprintd_service_26_0 hal_fingerprint_service_26_0 gatekeeper_service_26_0 gpu_service_26_0 inputflinger_service_26_0 incident_service_26_0 installd_service_26_0 keystore_service_26_0 mediaserver_service_26_0 mediametrics_service_26_0 mediaextractor_service_26_0 mediacodec_service_26_0 mediadrmserver_service_26_0 mediacasserver_service_26_0 netd_service_26_0 nfc_service_26_0 radio_service_26_0 storaged_service_26_0 surfaceflinger_service_26_0 system_app_service_26_0 update_engine_service_26_0 virtual_touchpad_service_26_0 vr_hwc_service_26_0 accessibility_service_26_0 account_service_26_0 activity_service_26_0 alarm_service_26_0 appops_service_26_0 appwidget_service_26_0 assetatlas_service_26_0 audio_service_26_0 autofill_service_26_0 backup_service_26_0 batterystats_service_26_0 battery_service_26_0 bluetooth_manager_service_26_0 cameraproxy_service_26_0 clipboard_service_26_0 contexthub_service_26_0 IProxyService_service_26_0 commontime_management_service_26_0 companion_device_service_26_0 connectivity_service_26_0 connmetrics_service_26_0 consumer_ir_service_26_0 content_service_26_0 country_detector_service_26_0 coverage_service_26_0 cpuinfo_service_26_0 dbinfo_service_26_0 device_policy_service_26_0 deviceidle_service_26_0 device_identifiers_service_26_0 devicestoragemonitor_service_26_0 diskstats_service_26_0 display_service_26_0 font_service_26_0 netd_listener_service_26_0 DockObserver_service_26_0 dreams_service_26_0 dropbox_service_26_0 ethernet_service_26_0 fingerprint_service_26_0 gfxinfo_service_26_0 graphicsstats_service_26_0 hardware_service_26_0 hardware_properties_service_26_0 hdmi_control_service_26_0 input_method_service_26_0 input_service_26_0 imms_service_26_0 ipsec_service_26_0 jobscheduler_service_26_0 launcherapps_service_26_0 location_service_26_0 lock_settings_service_26_0 media_projection_service_26_0 media_router_service_26_0 media_session_service_26_0 meminfo_service_26_0 midi_service_26_0 mount_service_26_0 netpolicy_service_26_0 netstats_service_26_0 network_management_service_26_0 network_score_service_26_0 network_time_update_service_26_0 notification_service_26_0 oem_lock_service_26_0 otadexopt_service_26_0 overlay_service_26_0 package_service_26_0 permission_service_26_0 persistent_data_block_service_26_0 pinner_service_26_0 power_service_26_0 print_service_26_0 processinfo_service_26_0 procstats_service_26_0 recovery_service_26_0 registry_service_26_0 restrictions_service_26_0 rttmanager_service_26_0 samplingprofiler_service_26_0 scheduling_policy_service_26_0 search_service_26_0 sec_key_att_app_id_provider_service_26_0 sensorservice_service_26_0 serial_service_26_0 servicediscovery_service_26_0 settings_service_26_0 shortcut_service_26_0 statusbar_service_26_0 storagestats_service_26_0 task_service_26_0 textclassification_service_26_0 textservices_service_26_0 telecom_service_26_0 trust_service_26_0 tv_input_service_26_0 uimode_service_26_0 updatelock_service_26_0 usagestats_service_26_0 usb_service_26_0 user_service_26_0 vibrator_service_26_0 voiceinteraction_service_26_0 vr_manager_service_26_0 wallpaper_service_26_0 webviewupdate_service_26_0 wifip2p_service_26_0 wifiscanner_service_26_0 wifi_service_26_0 wificond_service_26_0 wifiaware_service_26_0 window_service_26_0))
+(typeattributeset service_manager_type (audioserver_service_26_0 batteryproperties_service_26_0 bluetooth_service_26_0 cameraserver_service_26_0 default_android_service_26_0 drmserver_service_26_0 dumpstate_service_26_0 fingerprintd_service_26_0 hal_fingerprint_service_26_0 gatekeeper_service_26_0 gpu_service_26_0 inputflinger_service_26_0 incident_service_26_0 installd_service_26_0 keystore_service_26_0 mediaserver_service_26_0 mediametrics_service_26_0 mediaextractor_service_26_0 mediacodec_service_26_0 mediadrmserver_service_26_0 mediacasserver_service_26_0 netd_service_26_0 nfc_service_26_0 radio_service_26_0 storaged_service_26_0 surfaceflinger_service_26_0 system_app_service_26_0 update_engine_service_26_0 virtual_touchpad_service_26_0 vr_hwc_service_26_0 accessibility_service_26_0 account_service_26_0 activity_service_26_0 alarm_service_26_0 appops_service_26_0 appwidget_service_26_0 assetatlas_service_26_0 audio_service_26_0 autofill_service_26_0 backup_service_26_0 batterystats_service_26_0 battery_service_26_0 bluetooth_manager_service_26_0 cameraproxy_service_26_0 clipboard_service_26_0 contexthub_service_26_0 IProxyService_service_26_0 commontime_management_service_26_0 companion_device_service_26_0 connectivity_service_26_0 connmetrics_service_26_0 consumer_ir_service_26_0 content_service_26_0 country_detector_service_26_0 coverage_service_26_0 cpuinfo_service_26_0 dbinfo_service_26_0 device_policy_service_26_0 deviceidle_service_26_0 device_identifiers_service_26_0 devicestoragemonitor_service_26_0 diskstats_service_26_0 display_service_26_0 font_service_26_0 netd_listener_service_26_0 DockObserver_service_26_0 dreams_service_26_0 dropbox_service_26_0 ethernet_service_26_0 fingerprint_service_26_0 gfxinfo_service_26_0 graphicsstats_service_26_0 hardware_service_26_0 hardware_properties_service_26_0 hdmi_control_service_26_0 input_method_service_26_0 input_service_26_0 imms_service_26_0 ipsec_service_26_0 jobscheduler_service_26_0 launcherapps_service_26_0 location_service_26_0 lock_settings_service_26_0 media_projection_service_26_0 media_router_service_26_0 media_session_service_26_0 meminfo_service_26_0 midi_service_26_0 mount_service_26_0 netpolicy_service_26_0 netstats_service_26_0 network_management_service_26_0 network_score_service_26_0 network_time_update_service_26_0 notification_service_26_0 oem_lock_service_26_0 otadexopt_service_26_0 overlay_service_26_0 package_service_26_0 permission_service_26_0 persistent_data_block_service_26_0 pinner_service_26_0 power_service_26_0 print_service_26_0 processinfo_service_26_0 procstats_service_26_0 recovery_service_26_0 registry_service_26_0 restrictions_service_26_0 rttmanager_service_26_0 samplingprofiler_service_26_0 scheduling_policy_service_26_0 search_service_26_0 sec_key_att_app_id_provider_service_26_0 sensorservice_service_26_0 serial_service_26_0 servicediscovery_service_26_0 settings_service_26_0 shortcut_service_26_0 statusbar_service_26_0 storagestats_service_26_0 task_service_26_0 textclassification_service_26_0 textservices_service_26_0 telecom_service_26_0 trust_service_26_0 tv_input_service_26_0 uimode_service_26_0 updatelock_service_26_0 usagestats_service_26_0 usb_service_26_0 user_service_26_0 vibrator_service_26_0 voiceinteraction_service_26_0 vr_manager_service_26_0 wallpaper_service_26_0 webviewupdate_service_26_0 wifip2p_service_26_0 wifiscanner_service_26_0 wifi_service_26_0 wificond_service_26_0 wifiaware_service_26_0 window_service_26_0 cnbot_service_26_0))
 (typeattributeset hwservice_manager_type (default_android_hwservice_26_0 fwk_display_hwservice_26_0 fwk_scheduler_hwservice_26_0 fwk_sensor_hwservice_26_0 hal_audio_hwservice_26_0 hal_bluetooth_hwservice_26_0 hal_bootctl_hwservice_26_0 hal_camera_hwservice_26_0 hal_configstore_ISurfaceFlingerConfigs_26_0 hal_contexthub_hwservice_26_0 hal_drm_hwservice_26_0 hal_dumpstate_hwservice_26_0 hal_fingerprint_hwservice_26_0 hal_gatekeeper_hwservice_26_0 hal_gnss_hwservice_26_0 hal_graphics_allocator_hwservice_26_0 hal_graphics_composer_hwservice_26_0 hal_graphics_mapper_hwservice_26_0 hal_health_hwservice_26_0 hal_ir_hwservice_26_0 hal_keymaster_hwservice_26_0 hal_light_hwservice_26_0 hal_memtrack_hwservice_26_0 hal_nfc_hwservice_26_0 hal_oemlock_hwservice_26_0 hal_omx_hwservice_26_0 hal_power_hwservice_26_0 hal_renderscript_hwservice_26_0 hal_sensors_hwservice_26_0 hal_telephony_hwservice_26_0 hal_thermal_hwservice_26_0 hal_tv_cec_hwservice_26_0 hal_tv_input_hwservice_26_0 hal_usb_hwservice_26_0 hal_vibrator_hwservice_26_0 hal_vr_hwservice_26_0 hal_weaver_hwservice_26_0 hal_wifi_hwservice_26_0 hal_wifi_supplicant_hwservice_26_0 hidl_allocator_hwservice_26_0 hidl_base_hwservice_26_0 hidl_manager_hwservice_26_0 hidl_memory_hwservice_26_0 hidl_token_hwservice_26_0 system_wifi_keystore_hwservice_26_0))
 (typeattributeset same_process_hwservice (hal_graphics_mapper_hwservice_26_0 hal_renderscript_hwservice_26_0))
 (typeattributeset coredomain_hwservice (fwk_display_hwservice_26_0 fwk_scheduler_hwservice_26_0 fwk_sensor_hwservice_26_0 hidl_allocator_hwservice_26_0 hidl_manager_hwservice_26_0 hidl_memory_hwservice_26_0 hidl_token_hwservice_26_0 system_wifi_keystore_hwservice_26_0))
@@ -1518,6 +1518,8 @@
 (typeattribute zygote_26_0)
 (roletype object_r zygote_26_0)
 (typeattribute zygote_exec_26_0)
+(roletype object_r cnbot_service_26_0)
+(typeattribute cnbot_service_26_0)
 (roletype object_r zygote_exec_26_0)
 (type hostapd_socket)
 (roletype object_r hostapd_socket)
diff --git a/system/sepolicy/prebuilts/api/26.0/private/service_contexts b/system/sepolicy/prebuilts/api/26.0/private/service_contexts
index dc77cb9..cf0dec9 100644
--- a/system/sepolicy/prebuilts/api/26.0/private/service_contexts
+++ b/system/sepolicy/prebuilts/api/26.0/private/service_contexts
@@ -169,4 +169,5 @@ wifi                                      u:object_r:wifi_service:s0
 wificond                                  u:object_r:wificond_service:s0
 wifiaware                                 u:object_r:wifiaware_service:s0
 window                                    u:object_r:window_service:s0
+cnbot                      		  u:object_r:cnbot_service:s0
 *                                         u:object_r:default_android_service:s0
diff --git a/system/sepolicy/prebuilts/api/26.0/public/service.te b/system/sepolicy/prebuilts/api/26.0/public/service.te
index da540db..e96bdbf 100644
--- a/system/sepolicy/prebuilts/api/26.0/public/service.te
+++ b/system/sepolicy/prebuilts/api/26.0/public/service.te
@@ -145,3 +145,4 @@ type wifi_service, app_api_service, system_server_service, service_manager_type;
 type wificond_service, service_manager_type;
 type wifiaware_service, app_api_service, system_server_service, service_manager_type;
 type window_service, system_api_service, system_server_service, service_manager_type;
+type cnbot_service,app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
diff --git a/system/sepolicy/private/compat/26.0/26.0.cil b/system/sepolicy/private/compat/26.0/26.0.cil
index 40bec84..2813737 100644
--- a/system/sepolicy/private/compat/26.0/26.0.cil
+++ b/system/sepolicy/private/compat/26.0/26.0.cil
@@ -706,3 +706,4 @@
 (typeattributeset zygote_26_0 (zygote))
 (typeattributeset zygote_exec_26_0 (zygote_exec))
 (typeattributeset zygote_socket_26_0 (zygote_socket))
+(typeattributeset cnbot_service_26_0 (cnbot_service))
diff --git a/system/sepolicy/private/service_contexts b/system/sepolicy/private/service_contexts
index a82243f..e7a1ce0 100644
--- a/system/sepolicy/private/service_contexts
+++ b/system/sepolicy/private/service_contexts
@@ -171,4 +171,5 @@ wifi                                      u:object_r:wifi_service:s0
 wificond                                  u:object_r:wificond_service:s0
 wifiaware                                 u:object_r:wifiaware_service:s0
 window                                    u:object_r:window_service:s0
+cnbot                     		  u:object_r:cnbot_service:s0
 *                                         u:object_r:default_android_service:s0
diff --git a/system/sepolicy/public/service.te b/system/sepolicy/public/service.te
index e97b864..df51a95 100644
--- a/system/sepolicy/public/service.te
+++ b/system/sepolicy/public/service.te
@@ -148,3 +148,4 @@ type wifi_service, app_api_service, system_server_service, service_manager_type;
 type wificond_service, service_manager_type;
 type wifiaware_service, app_api_service, system_server_service, service_manager_type;
 type window_service, system_api_service, system_server_service, service_manager_type;
+type cnbot_service,app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值