TYPE3
[iec.git] / src / type3_AndroidCloud / anbox-master / android / appmgr / src / org / anbox / appmgr / LauncherService.java
1 /*
2  * Copyright (C) 2016 Simon Fels <morphis@gravedo.de>
3  *
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.
7  *
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.
12  *
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/>.
15  *
16  */
17
18 package org.anbox.appmgr;
19
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;
25
26 public final class LauncherService extends Service {
27     public static final String TAG = "AnboxAppMgr";
28
29     private PlatformService mPlatformService;
30     private PackageEventReceiver mPkgEventReceiver;
31
32     public LauncherService() {
33         super();
34         Log.i(TAG, "Service created");
35     }
36
37     @Override
38     public void onCreate() {
39         mPlatformService = new PlatformService(getBaseContext());
40
41         // Send the current list of applications over to the host so
42         // it can rebuild its list of available applications.
43         mPlatformService.sendApplicationListUpdate();
44
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");
50
51         mPkgEventReceiver = new PackageEventReceiver();
52         registerReceiver(mPkgEventReceiver, filter);
53
54         Log.i(TAG, "Service started");
55     }
56
57     @Override
58     public void onDestroy() {
59         Log.i(TAG, "Service stopped");
60     }
61
62     @Override
63     public IBinder onBind(Intent intent) {
64         return null;
65     }
66 }