当前位置: 首页 > article >正文

在Android13上添加系统服务的好用例子

在Android13上添加一个自动的system service例子

留好,备用。

---
 .../prebuilts/api/30.0/plat_pub_versioned.cil | 76 ++++++++++++++-
 .../prebuilts/api/31.0/plat_pub_versioned.cil | 94 ++++++++++++++++++-
 .../prebuilts/api/32.0/plat_pub_versioned.cil | 94 ++++++++++++++++++-
 frameworks/base/core/api/current.txt          | 18 ++++
 .../android/app/SystemServiceRegistry.java    | 25 ++++-
 .../core/java/android/bean/BeanManager.java   | 50 ++++++++++
 .../core/java/android/bean/IBeanManager.aidl  | 16 ++++
 .../base/core/java/android/bean/Person.aidl   |  3 +
 .../base/core/java/android/bean/Person.java   | 74 +++++++++++++++
 .../core/java/android/content/Context.java    | 12 +++
 .../server/bean/BeanManagerService.java       | 71 ++++++++++++++
 .../java/com/android/server/SystemServer.java | 11 ++-
 .../api/28.0/private/service_contexts         |  1 +
 .../api/28.0/private/system_server.te         |  2 +
 .../api/28.0/public/system_server.te          |  1 +
 .../api/29.0/private/service_contexts         |  1 +
 .../api/29.0/private/system_server.te         |  2 +
 .../prebuilts/api/29.0/public/service.te      |  1 +
 .../api/30.0/private/service_contexts         |  1 +
 .../api/30.0/private/system_server.te         |  1 +
 .../prebuilts/api/30.0/public/service.te      |  1 +
 .../api/31.0/private/service_contexts         |  1 +
 .../api/31.0/private/system_server.te         |  1 +
 .../prebuilts/api/31.0/public/service.te      |  1 +
 .../api/32.0/private/service_contexts         |  1 +
 .../api/32.0/private/system_server.te         |  1 +
 .../prebuilts/api/32.0/public/service.te      |  1 +
 .../api/33.0/private/service_contexts         |  1 +
 .../api/33.0/private/system_server.te         |  2 +
 .../prebuilts/api/33.0/public/service.te      |  1 +
 system/sepolicy/private/service_contexts      |  1 +
 system/sepolicy/private/system_server.te      |  2 +
 system/sepolicy/public/service.te             |  1 +
 33 files changed, 561 insertions(+), 8 deletions(-)
 create mode 100644 frameworks/base/core/java/android/bean/BeanManager.java
 create mode 100644 frameworks/base/core/java/android/bean/IBeanManager.aidl
 create mode 100644 frameworks/base/core/java/android/bean/Person.aidl
 create mode 100644 frameworks/base/core/java/android/bean/Person.java
 create mode 100644 frameworks/base/services/core/java/com/android/server/bean/BeanManagerService.java

diff --git a/device/qcom/sepolicy/prebuilts/api/30.0/plat_pub_versioned.cil b/device/qcom/sepolicy/prebuilts/api/30.0/plat_pub_versioned.cil
index ac63b142bc..b6a28cc608 100644
--- a/device/qcom/sepolicy/prebuilts/api/30.0/plat_pub_versioned.cil
+++ b/device/qcom/sepolicy/prebuilts/api/30.0/plat_pub_versioned.cil
@@ -1 +1,75 @@
-;; this file should not be empty
+(type vendor_smcinvoke_device)
+(type vendor_qtelephony)
+(type vendor_dpmd)
+(type vendor_dun-server)
+(type vendor_elabel_data_file)
+(type vendor_dpmtcm_socket)
+(type vendor_seempdw_socket)
+(type vendor_fm_app)
+(type vendor_hal_atfwd_hwservice)
+(type vendor_sigmahal_hwservice)
+(type vendor_qccsyshal_hwservice)
+(type vendor_location_app)
+(type vendor_mmi_sys)
+(type vendor_perfservice)
+(type vendor_persist_dpm_prop)
+(type vendor_persist_camera_prop)
+(type vendor_bt_prop)
+(type vendor_sys_video_prop)
+(type vendor_wlc_prop)
+(type vendor_qcc_app)
+(type vendor_qcc_trd)
+(type vendor_qcc_utils_app)
+(type vendor_qspmsvc)
+(type qti-testscripts)
+(type vendor_qvrd)
+(type vendor_seempd)
+(type vendor_usta_app_service)
+(type vendor_vpsservice)
+(type vendor_wfd_app)
+(type vendor_wfdservice)
+(type vendor_sigmahal_qti)
+(type vendor_dataservice_app)
+(typeattribute vendor_smcinvoke_device_30_0)
+(typeattribute vendor_qtelephony_30_0)
+(typeattribute vendor_dpmd_30_0)
+(typeattribute vendor_dun-server_30_0)
+(typeattribute vendor_elabel_data_file_30_0)
+(typeattribute vendor_dpmtcm_socket_30_0)
+(typeattribute vendor_seempdw_socket_30_0)
+(typeattribute vendor_fm_app_30_0)
+(typeattribute vendor_hal_atfwd_hwservice_30_0)
+(typeattribute vendor_sigmahal_hwservice_30_0)
+(typeattribute vendor_qccsyshal_hwservice_30_0)
+(typeattribute vendor_location_app_30_0)
+(typeattribute vendor_mmi_sys_30_0)
+(typeattribute vendor_perfservice_30_0)
+(typeattribute vendor_persist_dpm_prop_30_0)
+(typeattribute vendor_persist_camera_prop_30_0)
+(typeattribute vendor_bt_prop_30_0)
+(typeattribute vendor_sys_video_prop_30_0)
+(typeattribute vendor_wlc_prop_30_0)
+(typeattribute vendor_qcc_app_30_0)
+(typeattribute vendor_qcc_trd_30_0)
+(typeattribute vendor_qcc_utils_app_30_0)
+(typeattribute vendor_qspmsvc_30_0)
+(typeattribute qti-testscripts_30_0)
+(typeattribute vendor_qvrd_30_0)
+(typeattribute vendor_seempd_30_0)
+(typeattribute vendor_usta_app_service_30_0)
+(typeattribute vendor_vpsservice_30_0)
+(typeattribute vendor_wfd_app_30_0)
+(typeattribute vendor_wfdservice_30_0)
+(typeattribute vendor_sigmahal_qti_30_0)
+(typeattribute vendor_dataservice_app_30_0)
+(typeattribute vendor_hal_systemhelper)
+(typeattribute vendor_hal_systemhelper_client)
+(typeattribute vendor_hal_systemhelper_server)
+(type vendor_hal_systemhelper_hwservice)
+(type vendor_display_notch_prop)
+(type vendor_sys_qti_display)
+(type vendor_systemhelper_app)
+(typeattribute vendor_hal_systemhelper_hwservice_30_0)
+(typeattribute vendor_display_notch_prop_30_0)
+(typeattribute vendor_sys_qti_display_30_0)
+(typeattribute vendor_systemhelper_app_30_0)
diff --git a/device/qcom/sepolicy/prebuilts/api/31.0/plat_pub_versioned.cil b/device/qcom/sepolicy/prebuilts/api/31.0/plat_pub_versioned.cil
index ac63b142bc..35396982d8 100644
--- a/device/qcom/sepolicy/prebuilts/api/31.0/plat_pub_versioned.cil
+++ b/device/qcom/sepolicy/prebuilts/api/31.0/plat_pub_versioned.cil
@@ -1 +1,93 @@
-;; this file should not be empty
+(type vendor_smcinvoke_device)
+(type vendor_qtelephony)
+(type vendor_dpmd)
+(type vendor_dun-server)
+(type vendor_elabel_data_file)
+(type vendor_dpmtcm_socket)
+(type vendor_seempdw_socket)
+(type vendor_fm_app)
+(type vendor_hal_atfwd_hwservice)
+(type vendor_sigmahal_hwservice)
+(type vendor_qccsyshal_hwservice)
+(type vendor_location_app)
+(type vendor_mmi_sys)
+(type vendor_perfservice)
+(type vendor_persist_dpm_prop)
+(type vendor_persist_camera_prop)
+(type vendor_bt_prop)
+(type vendor_sys_video_prop)
+(type vendor_wlc_prop)
+(type vendor_qcc_app)
+(type vendor_qcc_trd)
+(type vendor_qcc_utils_app)
+(type vendor_qspmsvc)
+(type qti-testscripts)
+(type vendor_qvrd)
+(type vendor_seempd)
+(type vendor_usta_app_service)
+(type vendor_vpsservice)
+(type vendor_wfd_app)
+(type vendor_wfdservice)
+(type vendor_sigmahal_qti)
+(type vendor_dataservice_app)
+(type vendor_qesdk_service)
+(type vendor_qcc_authmgr_app)
+(type vendor_qcc_lmtp_app)
+(type vendor_qcc_netstat_app)
+(type vendor_qvirtmgr)
+(type vendor_hal_displayconfig_service)
+(type vendor_hal_telephony_service)
+(type vendor_persist_tcm_prop)
+(type vendor_persist_rcs_prop)
+(typeattribute vendor_smcinvoke_device_31_0)
+(typeattribute vendor_qtelephony_31_0)
+(typeattribute vendor_dpmd_31_0)
+(typeattribute vendor_dun-server_31_0)
+(typeattribute vendor_elabel_data_file_31_0)
+(typeattribute vendor_dpmtcm_socket_31_0)
+(typeattribute vendor_seempdw_socket_31_0)
+(typeattribute vendor_fm_app_31_0)
+(typeattribute vendor_hal_atfwd_hwservice_31_0)
+(typeattribute vendor_sigmahal_hwservice_31_0)
+(typeattribute vendor_qccsyshal_hwservice_31_0)
+(typeattribute vendor_location_app_31_0)
+(typeattribute vendor_mmi_sys_31_0)
+(typeattribute vendor_perfservice_31_0)
+(typeattribute vendor_persist_dpm_prop_31_0)
+(typeattribute vendor_persist_camera_prop_31_0)
+(typeattribute vendor_bt_prop_31_0)
+(typeattribute vendor_sys_video_prop_31_0)
+(typeattribute vendor_wlc_prop_31_0)
+(typeattribute vendor_qcc_app_31_0)
+(typeattribute vendor_qcc_trd_31_0)
+(typeattribute vendor_qcc_utils_app_31_0)
+(typeattribute vendor_qspmsvc_31_0)
+(typeattribute qti-testscripts_31_0)
+(typeattribute vendor_qvrd_31_0)
+(typeattribute vendor_seempd_31_0)
+(typeattribute vendor_usta_app_service_31_0)
+(typeattribute vendor_vpsservice_31_0)
+(typeattribute vendor_wfd_app_31_0)
+(typeattribute vendor_wfdservice_31_0)
+(typeattribute vendor_sigmahal_qti_31_0)
+(typeattribute vendor_dataservice_app_31_0)
+(typeattribute vendor_qesdk_service_31_0)
+(typeattribute vendor_qcc_authmgr_app_31_0)
+(typeattribute vendor_qcc_lmtp_app_31_0)
+(typeattribute vendor_qcc_netstat_app_31_0)
+(typeattribute vendor_qvirtmgr_31_0)
+(typeattribute vendor_hal_displayconfig_service_31_0)
+(typeattribute vendor_hal_telephony_service_31_0)
+(typeattribute vendor_persist_tcm_prop_31_0)
+(typeattribute vendor_persist_rcs_prop_30_0)
+(typeattribute vendor_hal_systemhelper)
+(typeattribute vendor_hal_systemhelper_client)
+(typeattribute vendor_hal_systemhelper_server)
+(type vendor_hal_systemhelper_hwservice)
+(type vendor_display_notch_prop)
+(type vendor_sys_qti_display)
+(type vendor_systemhelper_app)
+(typeattribute vendor_hal_systemhelper_hwservice_31_0)
+(typeattribute vendor_display_notch_prop_31_0)
+(typeattribute vendor_sys_qti_display_31_0)
+(typeattribute vendor_systemhelper_app_31_0)
diff --git a/device/qcom/sepolicy/prebuilts/api/32.0/plat_pub_versioned.cil b/device/qcom/sepolicy/prebuilts/api/32.0/plat_pub_versioned.cil
index ac63b142bc..becda6acb8 100644
--- a/device/qcom/sepolicy/prebuilts/api/32.0/plat_pub_versioned.cil
+++ b/device/qcom/sepolicy/prebuilts/api/32.0/plat_pub_versioned.cil
@@ -1 +1,93 @@
-;; this file should not be empty
+(type vendor_smcinvoke_device)
+(type vendor_qtelephony)
+(type vendor_dpmd)
+(type vendor_dun-server)
+(type vendor_elabel_data_file)
+(type vendor_dpmtcm_socket)
+(type vendor_seempdw_socket)
+(type vendor_fm_app)
+(type vendor_hal_atfwd_hwservice)
+(type vendor_sigmahal_hwservice)
+(type vendor_qccsyshal_hwservice)
+(type vendor_location_app)
+(type vendor_mmi_sys)
+(type vendor_perfservice)
+(type vendor_persist_dpm_prop)
+(type vendor_persist_camera_prop)
+(type vendor_bt_prop)
+(type vendor_sys_video_prop)
+(type vendor_wlc_prop)
+(type vendor_qcc_app)
+(type vendor_qcc_trd)
+(type vendor_qcc_utils_app)
+(type vendor_qspmsvc)
+(type qti-testscripts)
+(type vendor_qvrd)
+(type vendor_seempd)
+(type vendor_usta_app_service)
+(type vendor_vpsservice)
+(type vendor_wfd_app)
+(type vendor_wfdservice)
+(type vendor_sigmahal_qti)
+(type vendor_dataservice_app)
+(type vendor_qesdk_service)
+(type vendor_qcc_authmgr_app)
+(type vendor_qcc_lmtp_app)
+(type vendor_qcc_netstat_app)
+(type vendor_qvirtmgr)
+(type vendor_hal_displayconfig_service)
+(type vendor_hal_telephony_service)
+(type vendor_persist_tcm_prop)
+(type vendor_persist_rcs_prop)
+(typeattribute vendor_smcinvoke_device_32_0)
+(typeattribute vendor_qtelephony_32_0)
+(typeattribute vendor_dpmd_32_0)
+(typeattribute vendor_dun-server_32_0)
+(typeattribute vendor_elabel_data_file_32_0)
+(typeattribute vendor_dpmtcm_socket_32_0)
+(typeattribute vendor_seempdw_socket_32_0)
+(typeattribute vendor_fm_app_32_0)
+(typeattribute vendor_hal_atfwd_hwservice_32_0)
+(typeattribute vendor_sigmahal_hwservice_32_0)
+(typeattribute vendor_qccsyshal_hwservice_32_0)
+(typeattribute vendor_location_app_32_0)
+(typeattribute vendor_mmi_sys_32_0)
+(typeattribute vendor_perfservice_32_0)
+(typeattribute vendor_persist_dpm_prop_32_0)
+(typeattribute vendor_persist_camera_prop_32_0)
+(typeattribute vendor_bt_prop_32_0)
+(typeattribute vendor_sys_video_prop_32_0)
+(typeattribute vendor_wlc_prop_32_0)
+(typeattribute vendor_qcc_app_32_0)
+(typeattribute vendor_qcc_trd_32_0)
+(typeattribute vendor_qcc_utils_app_32_0)
+(typeattribute vendor_qspmsvc_32_0)
+(typeattribute qti-testscripts_32_0)
+(typeattribute vendor_qvrd_32_0)
+(typeattribute vendor_seempd_32_0)
+(typeattribute vendor_usta_app_service_32_0)
+(typeattribute vendor_vpsservice_32_0)
+(typeattribute vendor_wfd_app_32_0)
+(typeattribute vendor_wfdservice_32_0)
+(typeattribute vendor_sigmahal_qti_32_0)
+(typeattribute vendor_dataservice_app_32_0)
+(typeattribute vendor_qesdk_service_32_0)
+(typeattribute vendor_qcc_authmgr_app_32_0)
+(typeattribute vendor_qcc_lmtp_app_32_0)
+(typeattribute vendor_qcc_netstat_app_32_0)
+(typeattribute vendor_qvirtmgr_32_0)
+(typeattribute vendor_hal_displayconfig_service_32_0)
+(typeattribute vendor_hal_telephony_service_32_0)
+(typeattribute vendor_persist_tcm_prop_32_0)
+(typeattribute vendor_persist_rcs_prop_30_0)
+(typeattribute vendor_hal_systemhelper)
+(typeattribute vendor_hal_systemhelper_client)
+(typeattribute vendor_hal_systemhelper_server)
+(type vendor_hal_systemhelper_hwservice)
+(type vendor_display_notch_prop)
+(type vendor_sys_qti_display)
+(type vendor_systemhelper_app)
+(typeattribute vendor_hal_systemhelper_hwservice_32_0)
+(typeattribute vendor_display_notch_prop_32_0)
+(typeattribute vendor_sys_qti_display_32_0)
+(typeattribute vendor_systemhelper_app_32_0)
diff --git a/frameworks/base/core/api/current.txt b/frameworks/base/core/api/current.txt
index c8a43db2f9..ecc1482006 100644
--- a/frameworks/base/core/api/current.txt
+++ b/frameworks/base/core/api/current.txt
@@ -8924,6 +8924,23 @@ package android.appwidget {
 
 }
 
+package android.bean {
+
+  public final class Person implements android.os.Parcelable {
+    ctor public Person();
+    ctor public Person(@NonNull String, int);
+    method public int describeContents();
+    method public int getAge();
+    method @NonNull public String getName();
+    method public void readFromParcel(@NonNull android.os.Parcel);
+    method public void setAge(int);
+    method public void setName(@NonNull String);
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.bean.Person> CREATOR;
+  }
+
+}
+
 package android.companion {
 
   public final class AssociationInfo implements android.os.Parcelable {
@@ -9774,6 +9791,7 @@ package android.content {
     field public static final String APP_SEARCH_SERVICE = "app_search";
     field public static final String AUDIO_SERVICE = "audio";
     field public static final String BATTERY_SERVICE = "batterymanager";
+    field public static final String BEAN_SERVICE = "bean";
     field public static final int BIND_ABOVE_CLIENT = 8; // 0x8
     field public static final int BIND_ADJUST_WITH_ACTIVITY = 128; // 0x80
     field public static final int BIND_ALLOW_OOM_MANAGEMENT = 16; // 0x10
diff --git a/frameworks/base/core/java/android/app/SystemServiceRegistry.java b/frameworks/base/core/java/android/app/SystemServiceRegistry.java
index 40192836e0..7ba20fe120 100644
--- a/frameworks/base/core/java/android/app/SystemServiceRegistry.java
+++ b/frameworks/base/core/java/android/app/SystemServiceRegistry.java
@@ -235,6 +235,8 @@ import android.view.textservice.TextServicesManager;
 import android.view.translation.ITranslationManager;
 import android.view.translation.TranslationManager;
 import android.view.translation.UiTranslationManager;
+import android.bean.IBeanManager;
+import android.bean.BeanManager;
 
 import com.android.internal.app.IAppOpsService;
 import com.android.internal.app.IBatteryStats;
@@ -282,10 +284,25 @@ public final class SystemServiceRegistry {
         //CHECKSTYLE:OFF IndentationCheck
         registerService(Context.ACCESSIBILITY_SERVICE, AccessibilityManager.class,
                 new CachedServiceFetcher<AccessibilityManager>() {
-            @Override
-            public AccessibilityManager createService(ContextImpl ctx) {
-                return AccessibilityManager.getInstance(ctx);
-            }});
+                    @Override
+                    public AccessibilityManager createService(ContextImpl ctx) {
+                        return AccessibilityManager.getInstance(ctx);
+                    }});
+
+        /*   20250520  */
+        registerService(Context.BEAN_SERVICE, BeanManager.class,
+                // 这里是CachedServiceFetcher抽象类的实现
+                new CachedServiceFetcher<BeanManager>() {
+                    // 抽象方法createService的实现,我们看到其实很简单,就是通过ServiceManager获取服务的binder代理对象
+                    @Override
+                    public BeanManager createService(ContextImpl ctx) throws ServiceNotFoundException {
+                        IBinder b = ServiceManager.getServiceOrThrow(Context.BEAN_SERVICE);
+                        IBeanManager service = IBeanManager.Stub.asInterface(b);
+                        // 以IBeanManager和Context为参数构造BeanManager,这样我们通过Context.getSysetemService(Context.BEAN_SERVICE)
+                        // 返回的对象就是BeanManager
+                        return new BeanManager(service, ctx);
+                    }});
+
 
         registerService(Context.CAPTIONING_SERVICE, CaptioningManager.class,
                 new CachedServiceFetcher<CaptioningManager>() {
diff --git a/frameworks/base/core/java/android/bean/BeanManager.java b/frameworks/base/core/java/android/bean/BeanManager.java
new file mode 100644
index 0000000000..7535f88d7b
--- /dev/null
+++ b/frameworks/base/core/java/android/bean/BeanManager.java
@@ -0,0 +1,50 @@
+package android.bean;
+
+import android.annotation.NonNull;
+import android.content.Context;
+import android.os.RemoteException;
+import android.util.Log;
+
+/**
+* {@hide}
+*/
+public class BeanManager {
+
+    private static final String TAG = "BeanManager";
+    private Context mContext;
+    private IBeanManager mService;
+
+    public BeanManager(IBeanManager service, Context ctx) {
+        Log.d(TAG, "new BeanManager");
+        mService = service;
+        mContext = ctx;
+    }
+
+    public void sayHello(@NonNull String words) {
+      Log.d(TAG, "sayHello words: " + words);
+        if (mService == null) {
+            Log.d(TAG, "sayHello mService is null!!!");
+            return;
+        }
+
+        try {
+            mService.sayHello(words);
+        } catch (RemoteException e) {
+            throw e.rethrowFromSystemServer();
+        }
+    }
+
+    public void sayHelloTo(@NonNull Person person, @NonNull String words) {
+        Log.d(TAG, "sayHelloTo " + person.getName() + ": " + words);
+          if (mService == null) {
+              Log.d(TAG, "sayHelloTo mService is null!!!");
+              return;
+          }
+
+          try {
+              mService.sayHelloTo(person, words);
+          } catch (RemoteException e) {
+              throw e.rethrowFromSystemServer();
+          }
+      }
+}
diff --git a/frameworks/base/core/java/android/bean/IBeanManager.aidl b/frameworks/base/core/java/android/bean/IBeanManager.aidl
new file mode 100644
index 0000000000..48a3b22107
--- /dev/null
+++ b/frameworks/base/core/java/android/bean/IBeanManager.aidl
@@ -0,0 +1,16 @@
+package android.bean;
+
+import android.bean.Person;
+
+/**
+ * {@hide}
+ */
+interface IBeanManager {
+    void sayHello(String words);
+    // 自定义类型前面必须加上in或者out或者inout标识符
+    // in:    表示参数只能由客户端传递到服务端,基本类型默认只支持in修饰符
+    // out:   表示参数只能由服务端传递到客户端,服务端如果修改了参数对象的值
+    //        那么客户端的值也会改变,但是服务端无法读取客户端对象的值
+    // inout: 表示参数可以双向传递
+    void sayHelloTo(in Person person, String words);
+}
diff --git a/frameworks/base/core/java/android/bean/Person.aidl b/frameworks/base/core/java/android/bean/Person.aidl
new file mode 100644
index 0000000000..a4518f1601
--- /dev/null
+++ b/frameworks/base/core/java/android/bean/Person.aidl
@@ -0,0 +1,3 @@
+package android.bean;
+
+parcelable Person;
diff --git a/frameworks/base/core/java/android/bean/Person.java b/frameworks/base/core/java/android/bean/Person.java
new file mode 100644
index 0000000000..474cd897a2
--- /dev/null
+++ b/frameworks/base/core/java/android/bean/Person.java
@@ -0,0 +1,74 @@
+package android.bean;
+
+import android.annotation.NonNull;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+public final class Person implements Parcelable {
+    // 注意定义成员变量的顺序,后面读取和写入都必须按这个顺序
+    private String mName;
+    private int mAge;
+
+    public Person() {
+    }
+
+    public Person(@NonNull String name, int age) {
+        this.mName = name;
+        this.mAge = age;
+    }
+
+    private Person(@NonNull Parcel in) {
+        // 注意定义成员变量的顺序
+        this.mName = in.readString();
+        this.mAge = in.readInt();
+    }
+
+    @NonNull
+    public String getName() {
+        return mName;
+    }
+
+    public int getAge() {
+        return mAge;
+    }
+
+    public void setName(@NonNull String name) {
+        mName = name;
+    }
+
+    public void setAge(int age) {
+        mAge = age;
+    }
+
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    // 
+    @Override
+    public void writeToParcel(@NonNull Parcel dest, int flags) {
+        // 注意定义成员变量的顺序
+        dest.writeString(this.mName);
+        dest.writeInt(this.mAge);
+    }
+
+    public void readFromParcel(@NonNull Parcel source) {
+        // 注意定义成员变量的顺序
+        this.mName = source.readString();
+        this.mAge = source.readInt();
+    }
+
+    @NonNull
+    public static final Parcelable.Creator<Person> CREATOR = new Parcelable.Creator<Person>() {
+        @Override
+        public Person createFromParcel(@NonNull Parcel source) {
+            return new Person(source);
+        }
+
+        @Override
+        public Person[] newArray(int size) {
+            return new Person[size];
+        }
+    };
+}
diff --git a/frameworks/base/core/java/android/content/Context.java b/frameworks/base/core/java/android/content/Context.java
index fce23cf681..831c46e36f 100644
--- a/frameworks/base/core/java/android/content/Context.java
+++ b/frameworks/base/core/java/android/content/Context.java
@@ -3809,6 +3809,7 @@ public abstract class Context {
             ACCOUNT_SERVICE,
             ACTIVITY_SERVICE,
             ALARM_SERVICE,
+            BEAN_SERVICE,
             NOTIFICATION_SERVICE,
             ACCESSIBILITY_SERVICE,
             CAPTIONING_SERVICE,
@@ -4247,6 +4248,17 @@ public abstract class Context {
      */
     public static final String ACTIVITY_SERVICE = "activity";
 
+    /**
+     *  
+     * Use with {@link #getSystemService(String)} to retrieve a
+     * {@link android.bean.BeanManager} for interacting with the global
+     * system state.
+     *
+     * @see #getSystemService(String)
+     * @see android.bean.BeanManager
+     */
+    public static final String BEAN_SERVICE = "bean";
+
     /**
      * Use with {@link #getSystemService(String)} to retrieve a
      * {@link android.app.ActivityTaskManager} for interacting with the global system state.
diff --git a/frameworks/base/services/core/java/com/android/server/bean/BeanManagerService.java b/frameworks/base/services/core/java/com/android/server/bean/BeanManagerService.java
new file mode 100644
index 0000000000..4f5749b91e
--- /dev/null
+++ b/frameworks/base/services/core/java/com/android/server/bean/BeanManagerService.java
@@ -0,0 +1,71 @@
+package com.android.server.bean;
+
+import android.bean.IBeanManager;
+import android.bean.Person;
+import android.content.Context;
+import android.util.Log;
+
+import com.android.server.SystemService;
+import com.android.server.Watchdog;
+
+public class BeanManagerService extends IBeanManager.Stub
+        implements Watchdog.Monitor {
+
+    static final String TAG = "BeanManagerService";
+
+    final Context mContext;
+
+    public BeanManagerService(Context systemContext) {
+        Log.d(TAG, "BeanManagerService");
+        mContext = systemContext;
+        Watchdog.getInstance().addMonitor(this);
+    }
+
+    @Override
+    public void sayHello(String words) {
+        Log.d(TAG, " sayHello : " + words);
+    }
+
+    @Override
+    public void sayHelloTo(Person person, String words) {
+        Log.d(TAG, " sayHello " + person.getName() + ": " + words);
+    }
+
+    public void systemReady() {
+        Log.d(TAG, " systemReady ");
+    }
+
+    /** In this method we try to acquire our lock to make sure that we have not deadlocked */
+    public void monitor() {
+        synchronized (this) { }
+    }
+
+    // 这里我们定义了一个内部类继承SystemService,这样便于方便system_server统一管理启动服务
+    // 系统启动时会回调所有继承了SystemService的类的函数,比如onStart,onBootPhase等等。
+    public static final class Lifecycle extends SystemService {
+        static final String TAG = "BeanManagerService.Lifecycle";
+
+        private BeanManagerService mService;
+
+        public Lifecycle(Context context) {
+            super(context);
+            // 在这里构造我们的BeanManagerService对象
+            mService = new BeanManagerService(context);
+        }
+
+        @Override
+        public void onStart() {
+            Log.d(TAG, "onStart");
+            // 这里最终调用ServiceManager.addService
+            publishBinderService(Context.BEAN_SERVICE, mService);
+        }
+
+        @Override
+        public void onBootPhase(int phase) {
+            Log.d(TAG, "onBootPhase");
+            if (phase == SystemService.PHASE_ACTIVITY_MANAGER_READY) {
+                mService.systemReady();
+            }
+        }
+    }
+}
diff --git a/frameworks/base/services/java/com/android/server/SystemServer.java b/frameworks/base/services/java/com/android/server/SystemServer.java
index ce91cd2cc8..13cb7e09cf 100644
--- a/frameworks/base/services/java/com/android/server/SystemServer.java
+++ b/frameworks/base/services/java/com/android/server/SystemServer.java
@@ -111,6 +111,7 @@ import com.android.server.appbinding.AppBindingService;
 import com.android.server.art.ArtManagerLocal;
 import com.android.server.attention.AttentionManagerService;
 import com.android.server.audio.AudioService;
+import com.android.server.bean.BeanManagerService;
 import com.android.server.biometrics.AuthService;
 import com.android.server.biometrics.BiometricService;
 import com.android.server.biometrics.sensors.face.FaceService;
@@ -1404,7 +1405,7 @@ public final class SystemServer implements Dumpable {
      * Starts a miscellaneous grab bag of stuff that has yet to be refactored and organized.
      */
     private void startOtherServices(@NonNull TimingsTraceAndSlog t) {
-        t.traceBegin("startOtherServices");
+        t.traceBegin("c LA.QSSI, startOtherServices");
         mSystemServiceManager.updateOtherServicesStartIndex();
 
         final Context context = mSystemContext;
@@ -1473,6 +1474,14 @@ public final class SystemServer implements Dumpable {
                 }
             }, SECONDARY_ZYGOTE_PRELOAD);
 
+            // 
+            Slog.d(TAG, "  test add BeanManagerService.");
+            t.traceBegin("  BeanManagerService");
+            // 这里最终会通过反射的方法调用BeanManagerService.Lifecycle的构造函数
+            mSystemServiceManager.startService(BeanManagerService.Lifecycle.class);
+            t.traceEnd();
+
+
             t.traceBegin("StartKeyAttestationApplicationIdProviderService");
             ServiceManager.addService("sec_key_att_app_id_provider",
                     new KeyAttestationApplicationIdProviderService(context));
diff --git a/system/sepolicy/prebuilts/api/28.0/private/service_contexts b/system/sepolicy/prebuilts/api/28.0/private/service_contexts
index 5ec45a23ef..80f05057a6 100644
--- a/system/sepolicy/prebuilts/api/28.0/private/service_contexts
+++ b/system/sepolicy/prebuilts/api/28.0/private/service_contexts
@@ -185,4 +185,5 @@ wificond                                  u:object_r:wificond_service:s0
 wifiaware                                 u:object_r:wifiaware_service:s0
 wifirtt                                   u:object_r:rttmanager_service:s0
 window                                    u:object_r:window_service:s0
+bean                                      u:object_r:bean_service:s0
 *                                         u:object_r:default_android_service:s0
diff --git a/system/sepolicy/prebuilts/api/28.0/private/system_server.te b/system/sepolicy/prebuilts/api/28.0/private/system_server.te
index 8b1b4df6e6..aa7b791b73 100644
--- a/system/sepolicy/prebuilts/api/28.0/private/system_server.te
+++ b/system/sepolicy/prebuilts/api/28.0/private/system_server.te
@@ -866,3 +866,5 @@ neverallow system_server { domain -system_server }:process ptrace;
 # CAP_SYS_RESOURCE was traditionally needed for sensitive /proc/PID
 # file read access. However, that is now unnecessary (b/34951864)
 neverallow system_server system_server:global_capability_class_set sys_resource;
+
+allow system_server bean_service:service_manager add;
diff --git a/system/sepolicy/prebuilts/api/28.0/public/system_server.te b/system/sepolicy/prebuilts/api/28.0/public/system_server.te
index 805d6175d6..0592293f0b 100644
--- a/system/sepolicy/prebuilts/api/28.0/public/system_server.te
+++ b/system/sepolicy/prebuilts/api/28.0/public/system_server.te
@@ -3,3 +3,4 @@
 # Most of the framework services run in this process.
 #
 type system_server, domain;
+type bean_service, service_manager_type;
diff --git a/system/sepolicy/prebuilts/api/29.0/private/service_contexts b/system/sepolicy/prebuilts/api/29.0/private/service_contexts
index 96d553bf49..a397671972 100644
--- a/system/sepolicy/prebuilts/api/29.0/private/service_contexts
+++ b/system/sepolicy/prebuilts/api/29.0/private/service_contexts
@@ -219,4 +219,5 @@ wificond                                  u:object_r:wificond_service:s0
 wifiaware                                 u:object_r:wifiaware_service:s0
 wifirtt                                   u:object_r:rttmanager_service:s0
 window                                    u:object_r:window_service:s0
+bean                                      u:object_r:bean_service:s0
 *                                         u:object_r:default_android_service:s0
diff --git a/system/sepolicy/prebuilts/api/29.0/private/system_server.te b/system/sepolicy/prebuilts/api/29.0/private/system_server.te
index 5f60674b0e..8cb7f63464 100644
--- a/system/sepolicy/prebuilts/api/29.0/private/system_server.te
+++ b/system/sepolicy/prebuilts/api/29.0/private/system_server.te
@@ -1044,3 +1044,5 @@ neverallow {
   -system_server
 } password_slot_metadata_file:notdevfile_class_set ~{ relabelto getattr };
 neverallow { domain -init -system_server } password_slot_metadata_file:notdevfile_class_set *;
+
+allow system_server bean_service:service_manager add;
diff --git a/system/sepolicy/prebuilts/api/29.0/public/service.te b/system/sepolicy/prebuilts/api/29.0/public/service.te
index a2193d0edb..d4c5f7d737 100644
--- a/system/sepolicy/prebuilts/api/29.0/public/service.te
+++ b/system/sepolicy/prebuilts/api/29.0/public/service.te
@@ -187,6 +187,7 @@ type wifiaware_service, app_api_service, system_server_service, service_manager_
 type window_service, system_api_service, system_server_service, service_manager_type;
 type inputflinger_service, system_api_service, system_server_service, service_manager_type;
 type wpantund_service, system_api_service, service_manager_type;
+type bean_service,service_manager_type;
 
 ###
 ### Neverallow rules
diff --git a/system/sepolicy/prebuilts/api/30.0/private/service_contexts b/system/sepolicy/prebuilts/api/30.0/private/service_contexts
index 5c6f1a4766..2c8ee79c2f 100644
--- a/system/sepolicy/prebuilts/api/30.0/private/service_contexts
+++ b/system/sepolicy/prebuilts/api/30.0/private/service_contexts
@@ -247,4 +247,5 @@ wifinl80211                               u:object_r:wifinl80211_service:s0
 wifiaware                                 u:object_r:wifiaware_service:s0
 wifirtt                                   u:object_r:rttmanager_service:s0
 window                                    u:object_r:window_service:s0
+bean                                      u:object_r:bean_service:s0
 *                                         u:object_r:default_android_service:s0
diff --git a/system/sepolicy/prebuilts/api/30.0/private/system_server.te b/system/sepolicy/prebuilts/api/30.0/private/system_server.te
index 00828274d6..c965ba3eb0 100644
--- a/system/sepolicy/prebuilts/api/30.0/private/system_server.te
+++ b/system/sepolicy/prebuilts/api/30.0/private/system_server.te
@@ -1170,3 +1170,4 @@ neverallow system_server self:perf_event ~{ open write cpu kernel };
 
 # Do not allow any domain other than init or system server to set the property
 neverallow { domain -init -system_server } socket_hook_prop:property_service set;
+allow system_server bean_service:service_manager add;
diff --git a/system/sepolicy/prebuilts/api/30.0/public/service.te b/system/sepolicy/prebuilts/api/30.0/public/service.te
index f27772eabb..05540e0a79 100644
--- a/system/sepolicy/prebuilts/api/30.0/public/service.te
+++ b/system/sepolicy/prebuilts/api/30.0/public/service.te
@@ -205,6 +205,7 @@ type inputflinger_service, system_api_service, system_server_service, service_ma
 type wpantund_service, system_api_service, service_manager_type;
 type tethering_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
 type emergency_affordance_service, system_server_service, service_manager_type;
+type bean_service,service_manager_type;
 
 ###
 ### HAL Services
diff --git a/system/sepolicy/prebuilts/api/31.0/private/service_contexts b/system/sepolicy/prebuilts/api/31.0/private/service_contexts
index 3fd342b9be..71f3be55f0 100644
--- a/system/sepolicy/prebuilts/api/31.0/private/service_contexts
+++ b/system/sepolicy/prebuilts/api/31.0/private/service_contexts
@@ -307,4 +307,5 @@ wifinl80211                               u:object_r:wifinl80211_service:s0
 wifiaware                                 u:object_r:wifiaware_service:s0
 wifirtt                                   u:object_r:rttmanager_service:s0
 window                                    u:object_r:window_service:s0
+bean                                      u:object_r:bean_service:s0
 *                                         u:object_r:default_android_service:s0
diff --git a/system/sepolicy/prebuilts/api/31.0/private/system_server.te b/system/sepolicy/prebuilts/api/31.0/private/system_server.te
index 73301c1e9f..b046c5c0f8 100644
--- a/system/sepolicy/prebuilts/api/31.0/private/system_server.te
+++ b/system/sepolicy/prebuilts/api/31.0/private/system_server.te
@@ -1409,3 +1409,4 @@ neverallowxperm { domain -system_server } binder_device:chr_file ioctl { BINDER_
 # Only system server can write the font files.
 neverallow { domain -init -system_server } font_data_file:file no_w_file_perms;
 neverallow { domain -init -system_server } font_data_file:dir no_w_dir_perms;
+allow system_server bean_service:service_manager add;
diff --git a/system/sepolicy/prebuilts/api/31.0/public/service.te b/system/sepolicy/prebuilts/api/31.0/public/service.te
index ba7837d562..7da8ae30fa 100644
--- a/system/sepolicy/prebuilts/api/31.0/public/service.te
+++ b/system/sepolicy/prebuilts/api/31.0/public/service.te
@@ -268,6 +268,7 @@ type hal_secureclock_service, vendor_service, protected_service, service_manager
 type hal_sharedsecret_service, vendor_service, protected_service, service_manager_type;
 type hal_vibrator_service, vendor_service, protected_service, service_manager_type;
 type hal_weaver_service, vendor_service, protected_service, service_manager_type;
+type bean_service,service_manager_type;
 
 ###
 ### Neverallow rules
diff --git a/system/sepolicy/prebuilts/api/32.0/private/service_contexts b/system/sepolicy/prebuilts/api/32.0/private/service_contexts
index 3fd342b9be..71f3be55f0 100644
--- a/system/sepolicy/prebuilts/api/32.0/private/service_contexts
+++ b/system/sepolicy/prebuilts/api/32.0/private/service_contexts
@@ -307,4 +307,5 @@ wifinl80211                               u:object_r:wifinl80211_service:s0
 wifiaware                                 u:object_r:wifiaware_service:s0
 wifirtt                                   u:object_r:rttmanager_service:s0
 window                                    u:object_r:window_service:s0
+bean                                      u:object_r:bean_service:s0
 *                                         u:object_r:default_android_service:s0
diff --git a/system/sepolicy/prebuilts/api/32.0/private/system_server.te b/system/sepolicy/prebuilts/api/32.0/private/system_server.te
index 6aca000385..c9ae3aa3ec 100644
--- a/system/sepolicy/prebuilts/api/32.0/private/system_server.te
+++ b/system/sepolicy/prebuilts/api/32.0/private/system_server.te
@@ -1411,3 +1411,4 @@ neverallowxperm { domain -system_server } binder_device:chr_file ioctl { BINDER_
 # Only system server can write the font files.
 neverallow { domain -init -system_server } font_data_file:file no_w_file_perms;
 neverallow { domain -init -system_server } font_data_file:dir no_w_dir_perms;
+allow system_server bean_service:service_manager add;
diff --git a/system/sepolicy/prebuilts/api/32.0/public/service.te b/system/sepolicy/prebuilts/api/32.0/public/service.te
index ba7837d562..7da8ae30fa 100644
--- a/system/sepolicy/prebuilts/api/32.0/public/service.te
+++ b/system/sepolicy/prebuilts/api/32.0/public/service.te
@@ -268,6 +268,7 @@ type hal_secureclock_service, vendor_service, protected_service, service_manager
 type hal_sharedsecret_service, vendor_service, protected_service, service_manager_type;
 type hal_vibrator_service, vendor_service, protected_service, service_manager_type;
 type hal_weaver_service, vendor_service, protected_service, service_manager_type;
+type bean_service,service_manager_type;
 
 ###
 ### Neverallow rules
diff --git a/system/sepolicy/prebuilts/api/33.0/private/service_contexts b/system/sepolicy/prebuilts/api/33.0/private/service_contexts
index 72fa16629e..107139f764 100644
--- a/system/sepolicy/prebuilts/api/33.0/private/service_contexts
+++ b/system/sepolicy/prebuilts/api/33.0/private/service_contexts
@@ -384,4 +384,5 @@ wifinl80211                               u:object_r:wifinl80211_service:s0
 wifiaware                                 u:object_r:wifiaware_service:s0
 wifirtt                                   u:object_r:rttmanager_service:s0
 window                                    u:object_r:window_service:s0
+bean                                      u:object_r:bean_service:s0
 *                                         u:object_r:default_android_service:s0
diff --git a/system/sepolicy/prebuilts/api/33.0/private/system_server.te b/system/sepolicy/prebuilts/api/33.0/private/system_server.te
index 0f72c7fcfe..15e252f2d8 100644
--- a/system/sepolicy/prebuilts/api/33.0/private/system_server.te
+++ b/system/sepolicy/prebuilts/api/33.0/private/system_server.te
@@ -1486,3 +1486,5 @@ neverallowxperm { domain -system_server } binder_device:chr_file ioctl { BINDER_
 # Only system server can write the font files.
 neverallow { domain -init -system_server } font_data_file:file no_w_file_perms;
 neverallow { domain -init -system_server } font_data_file:dir no_w_dir_perms;
+
+allow system_server bean_service:service_manager add;
diff --git a/system/sepolicy/prebuilts/api/33.0/public/service.te b/system/sepolicy/prebuilts/api/33.0/public/service.te
index e862b405fe..2d0f7a9eb3 100644
--- a/system/sepolicy/prebuilts/api/33.0/public/service.te
+++ b/system/sepolicy/prebuilts/api/33.0/public/service.te
@@ -310,6 +310,7 @@ type hal_weaver_service, vendor_service, protected_service, hal_service_type, se
 type hal_nlinterceptor_service, vendor_service, protected_service, hal_service_type, service_manager_type;
 type hal_wifi_hostapd_service, vendor_service, protected_service, hal_service_type, service_manager_type;
 type hal_wifi_supplicant_service, vendor_service, protected_service, hal_service_type, service_manager_type;
+type bean_service,service_manager_type;
 
 ###
 ### Neverallow rules
diff --git a/system/sepolicy/private/service_contexts b/system/sepolicy/private/service_contexts
index 72fa16629e..107139f764 100644
--- a/system/sepolicy/private/service_contexts
+++ b/system/sepolicy/private/service_contexts
@@ -384,4 +384,5 @@ wifinl80211                               u:object_r:wifinl80211_service:s0
 wifiaware                                 u:object_r:wifiaware_service:s0
 wifirtt                                   u:object_r:rttmanager_service:s0
 window                                    u:object_r:window_service:s0
+bean                                      u:object_r:bean_service:s0
 *                                         u:object_r:default_android_service:s0
diff --git a/system/sepolicy/private/system_server.te b/system/sepolicy/private/system_server.te
index 0f72c7fcfe..15e252f2d8 100644
--- a/system/sepolicy/private/system_server.te
+++ b/system/sepolicy/private/system_server.te
@@ -1486,3 +1486,5 @@ neverallowxperm { domain -system_server } binder_device:chr_file ioctl { BINDER_
 # Only system server can write the font files.
 neverallow { domain -init -system_server } font_data_file:file no_w_file_perms;
 neverallow { domain -init -system_server } font_data_file:dir no_w_dir_perms;
+
+allow system_server bean_service:service_manager add;
diff --git a/system/sepolicy/public/service.te b/system/sepolicy/public/service.te
index e862b405fe..2d0f7a9eb3 100644
--- a/system/sepolicy/public/service.te
+++ b/system/sepolicy/public/service.te
@@ -310,6 +310,7 @@ type hal_weaver_service, vendor_service, protected_service, hal_service_type, se
 type hal_nlinterceptor_service, vendor_service, protected_service, hal_service_type, service_manager_type;
 type hal_wifi_hostapd_service, vendor_service, protected_service, hal_service_type, service_manager_type;
 type hal_wifi_supplicant_service, vendor_service, protected_service, hal_service_type, service_manager_type;
+type bean_service,service_manager_type;
 
 ###
 ### Neverallow rules
-- 
2.17.1


-- 

相关文章:

在Android13上添加系统服务的好用例子

在Android13上添加一个自动的system service例子 留好&#xff0c;备用。 --- .../prebuilts/api/30.0/plat_pub_versioned.cil | 76 - .../prebuilts/api/31.0/plat_pub_versioned.cil | 94 - .../prebuilts/api/32.0/plat_pub_versioned.cil | 94 - frameworks/base/co…...

HarmonyOS-ArkUI 自定义弹窗

自定义弹窗 自定义弹窗是界面开发中最为常用的一种弹窗写法。在自定义弹窗中&#xff0c; 布局样式完全由您决定&#xff0c;非常灵活。通常会被封装成工具类&#xff0c;以使得APP中所有弹窗具备相同的设计风格。 自定义弹窗具备的能力有 打开弹窗自定义布局&#xff0c;以…...

JVM——对象模型:JVM对象的内部机制和存在方式是怎样的?

引入 在Java的编程宇宙中&#xff0c;“Everything is object”是最核心的哲学纲领。当我们写下new Book()这样简单的代码时&#xff0c;JVM正在幕后构建一个复杂而精妙的“数据实体”——对象。这个看似普通的对象&#xff0c;实则是JVM内存管理、类型系统和多态机制的基石。…...

Java求职者面试:微服务技术与源码原理深度解析

Java求职者面试&#xff1a;微服务技术与源码原理深度解析 第一轮&#xff1a;基础概念问题 1. 请解释什么是微服务架构&#xff0c;并说明其优势和挑战。 微服务架构是一种将单体应用拆分为多个小型、独立的服务的软件开发方法。每个服务都运行在自己的进程中&#xff0c;并…...

[electron]预脚本不显示内联script

script-src self 是 Content Security Policy (CSP) 中的一个指令&#xff0c;它的作用是限制加载和执行 JavaScript 脚本的来源。 具体来说&#xff1a; self 表示 当前源。也就是说&#xff0c;只有来自当前网站或者当前页面所在域名的 JavaScript 脚本才被允许执行。"…...

开疆智能Ethernet/IP转Modbus网关连接斯巴拓压力传感器配置案例

本案例是将ModbusRTU协议的压力传感器数据上传到欧姆龙PLC&#xff0c;由于PLC采用的是Ethernet/IP通讯协议&#xff0c;两者无法直接进行数据采集。故使用开疆智能研发的Ethernet转Modbus网关进行数据转换。 配置过程 首先我们开始配置Ethernet/IP主站&#xff08;如罗克韦尔…...

【Redis】Redis 的持久化策略

目录 一、RDB 定期备份 1.2 触发方式 1.2.1 手动触发 1.2.2.1 自动触发 RDB 持久化机制的场景 1.2.2.2 检查是否触发 1.2.2.3 线上运维配置 1.3 检索工具 1.4 RDB 备份实现原理 1.5 禁用 RDB 快照 1.6 RDB 优缺点分析 二、AOF 实时备份 2.1 配置文件解析 2.2 开启…...

20250607在荣品的PRO-RK3566开发板的Android13系统下实现长按开机之后出现插入适配器不会自动启动的问题的解决

20250607在荣品的PRO-RK3566开发板的Android13系统下实现长按开机之后出现插入适配器不会自动启动的问题的解决 2025/6/7 17:20 缘起&#xff1a; 1、根据RK809的DATASHEET&#xff0c;短按开机【100ms/500ms】/长按关机&#xff0c;长按关机。6s/8s/10s 我在网上找到的DATASHE…...

Asp.net Core 通过依赖注入的方式获取用户

思路&#xff1a;Web项目中&#xff0c;需要根据当前登陆的用户&#xff0c;查询当前用户所属的数据、添加并标识对象等。根据请求头Authorization 中token&#xff0c;获取Redis中存储的用户对象。 本做法需要完成 基于StackExchange.Redis 配置&#xff0c;参考&#xff1a;…...

浏览器工作原理01 [#]Chrome架构:仅仅打开了1个页面,为什么有4个进程

引用 浏览器工作原理与实践 Chrome打开一个页面需要启动多少进程&#xff1f;你可以点击Chrome浏览器右上角的“选项”菜单&#xff0c;选择“更多工具”子菜单&#xff0c;点击“任务管理器”&#xff0c;这将打开Chrome的任务管理器的窗口&#xff0c;如下图 和Windows任务管…...

智能问数Text2SQL Vanna windows场景验证

架构 Vanna 是一个开源 Python RAG&#xff08;检索增强生成&#xff09;框架&#xff0c;用于 SQL 生成和相关功能。 机制 Vanna 的工作过程分为两个简单步骤 - 在您的数据上训练 RAG“模型”&#xff0c;然后提出问题&#xff0c;这些问题将返回 SQL 查询&#xff0c;这些查…...

【VLAs篇】02:Impromptu VLA—用于驱动视觉-语言-动作模型的开放权重和开放数据

项目描述论文标题Impromptu VLA&#xff1a;用于驱动视觉-语言-动作模型的开放权重和开放数据 (Impromptu VLA: Open Weights and Open Data for Driving Vision-Language-Action Models)研究问题自动驾驶的视觉-语言-动作 (VLA) 模型在非结构化角落案例场景中表现不佳&#xf…...

[学习笔记]使用git rebase做分支差异化同步

在一个.NET 项目中&#xff0c;使用了Volo.Abp库&#xff0c;但出于某种原因&#xff0c;需要源码调试&#xff0c;因此&#xff0c;使用源码方式集成的项目做了一个分支archive-abp-source 其中引用方式变更操作的提交为&#xff1a;7de53907 后续&#xff0c;在master分支中…...

Java + Spring Boot + Mybatis 插入数据后,获取自增 id 的方法

在 MyBatis 中使用 useGeneratedKeys"true" 获取新插入记录的自增 ID 值&#xff0c;可通过以下步骤实现&#xff1a; 1. 配置 Mapper XML 在插入语句的 <insert> 标签中设置&#xff1a; xml 复制 下载 运行 <insert id"insertUser" para…...

【Linux应用】Linux系统日志上报服务,以及thttpd的配置、发送函数

【Linux应用】Linux系统日志上报服务&#xff0c;以及thttpd的配置、发送函数 文章目录 thttpd服务安装thttpd配置thttpd服务thttpd函数日志效果和文件附录&#xff1a;开发板快速上手&#xff1a;镜像烧录、串口shell、外设挂载、WiFi配置、SSH连接、文件交互&#xff08;RADX…...

Nginx 事件驱动理解

在做埋点采集服务的过程中&#xff0c;主要依靠openresty加lua脚本来实现采集。高并发还是主要依靠nginx来实现。而其核心就是事件驱动/多路io复用&#xff08;epoll机制&#xff09;&#xff0c;不同的linux服务器都有对应的实现方式。 而epoll机制就是&#xff0c;应用启动的…...

Jmeter(四) - 如何在jmeter中创建网络测试计划

1.简介 如何创建基本的 测试计划来测试网站。您将创建五个用户&#xff0c;这些用户将请求发送到JMeter网站上的两个页面。另外&#xff0c;您将告诉用户两次运行测试。 因此&#xff0c;请求总数为&#xff08;5个用户&#xff09;x&#xff08;2个请求&#xff09;x&#xff…...

Amazon RDS on AWS Outposts:解锁本地化云数据库的混合云新体验

在混合云架构成为企业数字化转型标配的今天&#xff0c;如何在本地数据中心享受云数据库的强大能力&#xff0c;同时满足数据本地化、低延迟访问的严苛需求&#xff1f;Amazon RDS on AWS Outposts 给出了完美答案——将AWS完全托管的云数据库服务无缝延伸至您的机房&#xff0…...

2025年上海市“星光计划”第十一届职业院校技能大赛 网络安全赛项技能操作模块样题

2025年上海市“星光计划”第十一届职业院校技能大赛 网络安全赛项技能操作模块样题 &#xff08;二&#xff09;模块 A&#xff1a;安全事件响应、网络安全数据取证、应用安全、系统安全任务一&#xff1a;漏洞扫描与利用:任务二&#xff1a;Windows 操作系统渗透测试 :任务三&…...

jieba实现和用RNN实现中文分词的区别

Jieba 分词和基于 RNN 的分词在技术路线、实现机制、性能特点上有显著差异&#xff0c;以下是核心对比&#xff1a; 1. 技术路线对比 维度Jieba 分词RNN 神经网络分词范式传统 NLP&#xff08;规则 统计&#xff09;深度学习&#xff08;端到端学习&#xff09;核心依赖词典…...

android计算器代码

本次作业要求实现一个计算器应用的基础框架。以下是布局文件的核心代码&#xff1a; <LinearLayout xmlns:android"http://schemas.android.com/apk/res/android"android:layout_width"match_parent"android:layout_height"match_parent"andr…...

leetcode 386. 字典序排数 中等

给你一个整数 n &#xff0c;按字典序返回范围 [1, n] 内所有整数。 你必须设计一个时间复杂度为 O(n) 且使用 O(1) 额外空间的算法。 示例 1&#xff1a; 输入&#xff1a;n 13 输出&#xff1a;[1,10,11,12,13,2,3,4,5,6,7,8,9]示例 2&#xff1a; 输入&#xff1a;n 2…...

Modbus转ETHERNET IP网关:快速冷却系统的智能化升级密钥

现代工业自动化系统中&#xff0c;无锡耐特森Modbus转Ethernet IP网关MCN-EN3001扮演着至关重要的角色。通过这一技术&#xff0c;传统的串行通讯协议Modbus得以在更高速、更稳定的以太网环境中运行&#xff0c;为快速冷却系统等关键设施的自动化控制提供了强有力的支撑。快速冷…...

Linux——TCP和UDP

一、TCP协议 1.特点 TCP提供的是面向连接、可靠的、字节流服务。 2.编程流程 &#xff08;1&#xff09;服务器端的编程流程 ①socket() 方法创建套接字 ②bind()方法指定套接字使用的IP地址和端口。 ③listen()方法用来创建监听队列。 ④accept()方法处理客户端的连接…...

比较数据迁移后MySQL数据库和PostgreSQL数据仓库中的表

设计一个MySQL数据库和PostgreSQL数据库的表数据比较的详细程序流程,两张表是相同的结构,都有整型主键id字段,需要每次从数据库分批取得2000条数据,用于比较,比较操作的同时可以再取2000条数据,等上一次比较完成之后,开始比较,直到比较完所有的数据。比较操作需要比较两…...

云原生技术驱动 IT 架构现代化转型:企业实践与落地策略全解

&#x1f4dd;个人主页&#x1f339;&#xff1a;慌ZHANG-CSDN博客 &#x1f339;&#x1f339;期待您的关注 &#x1f339;&#x1f339; 一、背景&#xff1a;IT 架构演进的战略拐点 过去十年&#xff0c;企业 IT 架构经历了从传统集中式架构到分布式架构的转型。进入云计算…...

Android Settings 数据库生成、监听与默认值配置

一、Settings 数据库生成机制​ ​传统数据库生成&#xff08;Android 6.0 前&#xff09;​​ ​路径​&#xff1a;/data/data/com.android.providers.settings/databases/settings.db​创建流程​&#xff1a; ​SQL 脚本初始化​&#xff1a;通过 sqlite 工具创建数据库文件…...

SeaweedFS S3 Spring Boot Starter

SeaweedFS S3 Spring Boot Starter 源码特性环境要求快速开始1. 添加依赖2. 配置文件3. 使用方式方式一&#xff1a;注入服务类方式二&#xff1a;使用工具类 API 文档SeaweedFsS3Service 主要方法SeaweedFsS3Util 工具类方法 配置参数运行测试构建项目注意事项集成应用更多项目…...

Monorepo架构: 项目管理模式对比与考量

关于 monorepo 相关概念及项目管理模式 在软件开发中&#xff0c;尤其是前端项目&#xff0c;我们会涉及到不同的项目管理模式&#xff0c;这里先介绍几个重要的概念“monorepo”是当前较为热门的一种项目管理方式&#xff0c;虽然很多人可能听说过&#xff0c;但可能在实际项…...

智慧城市项目总体建设方案(Word700页+)

1 背景、现状和必要性 1.1 背景 1.1.1 立项背景情况 1.1.2 立项依据 1.2 现状 1.2.1 党建体系运行现状 1.2.2 政务体系运行现状 1.2.3 社会治理运行现状 1.2.4 安全监管体系现状 1.2.5 环保体系运行现状 1.2.6 城建体系运行现状 1.2.7 社区体系运行现状 1.2.8 园区…...