1 /* 2 * Copyright (C) 2023 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package com.android.server.ondevicepersonalization; 17 18 import static android.app.ondevicepersonalization.OnDevicePersonalizationSystemServiceManager.ON_DEVICE_PERSONALIZATION_SYSTEM_SERVICE; 19 20 import android.app.ondevicepersonalization.IOnDevicePersonalizationSystemService; 21 import android.app.ondevicepersonalization.IOnDevicePersonalizationSystemServiceCallback; 22 import android.content.Context; 23 import android.os.Bundle; 24 import android.os.RemoteException; 25 import android.util.Log; 26 27 import com.android.internal.annotations.VisibleForTesting; 28 import com.android.server.SystemService; 29 30 /** 31 * @hide 32 */ 33 public class OnDevicePersonalizationSystemService 34 extends IOnDevicePersonalizationSystemService.Stub { 35 private static final String TAG = "OnDevicePersonalizationSystemService"; 36 37 @VisibleForTesting OnDevicePersonalizationSystemService(Context context)38 OnDevicePersonalizationSystemService(Context context) { 39 } 40 onRequest( Bundle bundle, IOnDevicePersonalizationSystemServiceCallback callback)41 @Override public void onRequest( 42 Bundle bundle, 43 IOnDevicePersonalizationSystemServiceCallback callback) { 44 try { 45 callback.onResult(null); 46 } catch (RemoteException e) { 47 Log.e(TAG, "Callback error", e); 48 } 49 } 50 51 /** @hide */ 52 public static class Lifecycle extends SystemService { 53 private OnDevicePersonalizationSystemService mService; 54 55 /** @hide */ Lifecycle(Context context)56 public Lifecycle(Context context) { 57 super(context); 58 mService = new OnDevicePersonalizationSystemService(getContext()); 59 } 60 61 /** @hide */ 62 @Override onStart()63 public void onStart() { 64 publishBinderService(ON_DEVICE_PERSONALIZATION_SYSTEM_SERVICE, mService); 65 Log.i(TAG, "OnDevicePersonalizationSystemService started!"); 66 } 67 } 68 } 69