2 * Copyright (C) 2016 Simon Fels <morphis@gravedo.de>
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3, as published
6 * by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranties of
10 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11 * PURPOSE. See the GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program. If not, see <http://www.gnu.org/licenses/>.
18 package org.anbox.appmgr;
20 import android.app.Service;
21 import android.util.Log;
22 import android.content.Intent;
23 import android.content.IntentFilter;
24 import android.os.IBinder;
26 public final class LauncherService extends Service {
27 public static final String TAG = "AnboxAppMgr";
29 private PlatformService mPlatformService;
30 private PackageEventReceiver mPkgEventReceiver;
32 public LauncherService() {
34 Log.i(TAG, "Service created");
38 public void onCreate() {
39 mPlatformService = new PlatformService(getBaseContext());
41 // Send the current list of applications over to the host so
42 // it can rebuild its list of available applications.
43 mPlatformService.sendApplicationListUpdate();
45 IntentFilter filter = new IntentFilter();
46 filter.addAction(Intent.ACTION_PACKAGE_ADDED);
47 filter.addAction(Intent.ACTION_PACKAGE_CHANGED);
48 filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
49 filter.addDataScheme("package");
51 mPkgEventReceiver = new PackageEventReceiver();
52 registerReceiver(mPkgEventReceiver, filter);
54 Log.i(TAG, "Service started");
58 public void onDestroy() {
59 Log.i(TAG, "Service stopped");
63 public IBinder onBind(Intent intent) {