Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit df7db074 authored by Amith Yamasani's avatar Amith Yamasani
Browse files

Derive LauncherAppsService from SystemService

And encapsulate the aidl interface implementation.

Change-Id: Id9a2544b411648e2596de18682079a64e95b0710
parent 82ed45da
Loading
Loading
Loading
Loading
+302 −285
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ import android.util.Log;
import android.util.Slog;

import com.android.internal.content.PackageMonitor;
import com.android.server.SystemService;

import java.util.ArrayList;
import java.util.List;
@@ -48,7 +49,22 @@ import java.util.List;
 * Service that manages requests and callbacks for launchers that support
 * managed profiles. 
 */
public class LauncherAppsService extends ILauncherApps.Stub {

public class LauncherAppsService extends SystemService {

    private final LauncherAppsImpl mLauncherAppsImpl;

    public LauncherAppsService(Context context) {
        super(context);
        mLauncherAppsImpl = new LauncherAppsImpl(context);
    }

    @Override
    public void onStart() {
        publishBinderService(Context.LAUNCHER_APPS_SERVICE, mLauncherAppsImpl);
    }

    class LauncherAppsImpl extends ILauncherApps.Stub {
        private static final boolean DEBUG = false;
        private static final String TAG = "LauncherAppsService";
        private final Context mContext;
@@ -59,7 +75,7 @@ public class LauncherAppsService extends ILauncherApps.Stub {

        private MyPackageMonitor mPackageMonitor = new MyPackageMonitor();

    public LauncherAppsService(Context context) {
        public LauncherAppsImpl(Context context) {
            mContext = context;
            mPm = mContext.getPackageManager();
            mUm = (UserManager) mContext.getSystemService(Context.USER_SERVICE);
@@ -403,3 +419,4 @@ public class LauncherAppsService extends ILauncherApps.Stub {
            }
        }
    }
}
 No newline at end of file
+1 −2
Original line number Diff line number Diff line
@@ -998,8 +998,7 @@ public final class SystemServer {

            try {
                Slog.i(TAG, "LauncherAppsService");
                LauncherAppsService las = new LauncherAppsService(context);
                ServiceManager.addService(Context.LAUNCHER_APPS_SERVICE, las);
                mSystemServiceManager.startService(LauncherAppsService.class);
            } catch (Throwable t) {
                reportWtf("starting LauncherAppsService", t);
            }