• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2008 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 
17 package com.android.sdksetup;
18 
19 import android.app.Activity;
20 import android.content.ComponentName;
21 import android.content.pm.PackageManager;
22 import android.location.LocationManager;
23 import android.os.Bundle;
24 import android.provider.Settings;
25 
26 /**
27  * Entry point for SDK SetupWizard.
28  *
29  */
30 public class DefaultActivity extends Activity {
31 
32     @Override
onCreate(Bundle icicle)33     protected void onCreate(Bundle icicle) {
34         super.onCreate(icicle);
35 
36         // Add a persistent setting to allow other apps to know the device has been provisioned.
37         Settings.Secure.putInt(getContentResolver(), Settings.Secure.DEVICE_PROVISIONED, 1);
38 
39         // Enable the GPS.
40         // Not needed since this SDK will contain the Settings app.
41         Settings.Secure.putString(getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED, LocationManager.GPS_PROVIDER);
42 
43         // enable install from non market
44         Settings.Secure.putInt(getContentResolver(), Settings.Secure.INSTALL_NON_MARKET_APPS, 1);
45 
46         // remove this activity from the package manager.
47         PackageManager pm = getPackageManager();
48         ComponentName name = new ComponentName(this, DefaultActivity.class);
49         pm.setComponentEnabledSetting(name, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);
50 
51         // terminate the activity.
52         finish();
53     }
54 }
55 
56