This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

SK-AM62P-LP: Service is not run as a single user

Part Number: SK-AM62P-LP
Other Parts Discussed in Thread: AM62P

Tool/software:

Hi TI experts,

A "service" was created as a single user, and once booted, the service running in all available user (default for both User-0 and User-10)

Issue:  the service is executed by both User-0 and User-10.

The expected result is that the service is only running in User-0 (since singleUser=Tag).

we are using aosp SDK 09.02

  <service android:name=".ServiceName"
            android:singleUser="true"
            android:exported="true">
            <intent-filter>
                <action android:name="service.IService"/>
            </intent-filter>
   </service>

The service is getting start after receiving "RECEIVE_BOOT_COMPLETED"

Intent intentService = new Intent(context, AcudriveService.class);
        intentService.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        context.startService(intentService);

  • Hi Binil,

    According to https://source.android.com/docs/devices/admin/multiuser-apps

    Only system apps can currently use this feature

    Can you please confirm it has been configured as such?

    Can you please also provide additional details:

    • What commands are used to verify that the service runs as User-0 (and as User-10) ?
    • What lunch target is used? (am62p-userdebug or am62p_car-userdebug ?)
  • Hi ,

    We have created the app as system app and we verified that our apk comes under /system/priv-app/<App Name>

    FYI: make an app as system app

    Android.bp
    ----------
    android_app {
        name: "AppName",
        manifest: "AndroidManifest.xml",
        privileged: true,
        certificate: "platform",
        platform_apis: true,
        }

    >>What commands are used to verify that the service runs as User-0 (and as User-10) ?

    adb shell ps -e 

    >>What lunch target is used? 

    am62p_car-userdebug

  • Hi, thank you for the information.

    We will try to reproduce and come back to you.

  • Hi Binil,

    Can you also please confirm that you have followed:


    // Add on all entry points such as boot_completed or other manifest-listed receivers and providers
    if (!UserManager.isSystemUser()) {
        // Disable the service
        ComponentName targetServiceName = new ComponentName(this, TargetService.class);
        context.getPackageManager().setComponentEnabledSetting(
            targetServiceName, COMPONENT_ENABLED_STATE_DISABLED, 0);
    }

    We are still trying to find a way to reproduce


  • Thanks for the update

    in the below log, you can see the "com.android.car" is running in both "system" and "u10_system ".

    adb shell ps -e | grep car
    root           105     2          0      0 0                   0 S [card0-crtc0]
    root           111     2          0      0 0                   0 S [f2fs_discard-259:10]
    system         213     1   10965244   7676 0                   0 S carwatchdogd
    graphics       214     1   11103268  12772 0                   0 S cardisplayproxyd
    system         234     1   10921936   5436 0                   0 S carpowerpolicyd
    root           332     2          0      0 0                   0 S [f2fs_discard-254:34]
    system        1362   476   15744024 124712 0                   0 S com.android.car
    nobody        1455     1   10858496   3024 0                   0 S com.android.car.procfsinspector
    system        1456   476   15052884  94556 0                   0 S com.android.experimentalcar
    u10_system    2002   476   15093616 101340 0                   0 S com.android.car
    u10_a31       2546   476   15063024 106048 0                   0 S com.android.car.media
    u10_a25       2679   476   15138572 111776 0                   0 S com.android.car.radio:appService
    u10_a25       2822   476   15067784  98444 0                   0 S com.android.car.radio
    u0_a33        2846   476   15072720 106628 0                   0 S android.car.cluster
    u10_a47       2988   476   15092616  95720 0                   0 S com.android.car.dialer
    

  • Hi Binil,

    According to:  https://source.android.com/docs/devices/admin/multiuser-apps

    > Activities in your package will still be launched in a separate process for each user, with the UID being in the UID range for that user (such as 1010034).

    Could it be possible that:

    - The service is ran as system, displayed as com.android.car
    - An activity is ran as u10_system, also displayed as com.android.car ?


  • Looking at packages/services/Car/service-builtin/AndroidManifest.xml

    We can see:

            <service android:name=".CarService"                                                                                                                                                                                                                                                                                                                                                                                                 
                 android:singleUser="true"                                                                                                                                                                                                                                                                                                                                                                                                      
                 android:exported="true">                                                                                                                                                                                                                                                                                                                                                                                                       
                <intent-filter>                                                                                                                                                                                                                                                                                                                                                                                                                 
                    <action android:name="android.car.ICar"/>                                                                                                                                                                                                                                                                                                                                                                                   
                </intent-filter>                                                                                                                                                                                                                                                                                                                                                                                                                
            </service>   

    So CarService runs in single user, as system.

    However, the activity which is also part of com.android.car runs as user "10":

    am62p:/ # dumpsys activity com.android.car
    TASK 1010020:com.android.car.carlauncher id=1000001 userId=10 displayId=0(type=INTERNAL)

    So to me, this is normal behaviour.

  • Hi Mattijs,

    I am confused with your reply,

    I have a service similar to "CarService", where no activity is mentioned in AndroidManifest.xml. After boot completed my service is running both User-0, and User-10, in manifest I given the tag "android:singleUser="true".