1c4a805bf940c808a822c2de244f8becf43089c87Jean-Baptiste Queru/* 2c4a805bf940c808a822c2de244f8becf43089c87Jean-Baptiste Queru * Copyright (C) 2008 The Android Open Source Project 3c4a805bf940c808a822c2de244f8becf43089c87Jean-Baptiste Queru * 4c4a805bf940c808a822c2de244f8becf43089c87Jean-Baptiste Queru * Licensed under the Apache License, Version 2.0 (the "License"); 5c4a805bf940c808a822c2de244f8becf43089c87Jean-Baptiste Queru * you may not use this file except in compliance with the License. 6c4a805bf940c808a822c2de244f8becf43089c87Jean-Baptiste Queru * You may obtain a copy of the License at 7c4a805bf940c808a822c2de244f8becf43089c87Jean-Baptiste Queru * 8c4a805bf940c808a822c2de244f8becf43089c87Jean-Baptiste Queru * http://www.apache.org/licenses/LICENSE-2.0 9c4a805bf940c808a822c2de244f8becf43089c87Jean-Baptiste Queru * 10c4a805bf940c808a822c2de244f8becf43089c87Jean-Baptiste Queru * Unless required by applicable law or agreed to in writing, software 11c4a805bf940c808a822c2de244f8becf43089c87Jean-Baptiste Queru * distributed under the License is distributed on an "AS IS" BASIS, 12c4a805bf940c808a822c2de244f8becf43089c87Jean-Baptiste Queru * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13c4a805bf940c808a822c2de244f8becf43089c87Jean-Baptiste Queru * See the License for the specific language governing permissions and 14c4a805bf940c808a822c2de244f8becf43089c87Jean-Baptiste Queru * limitations under the License. 15c4a805bf940c808a822c2de244f8becf43089c87Jean-Baptiste Queru */ 16c4a805bf940c808a822c2de244f8becf43089c87Jean-Baptiste Queru 17c4a805bf940c808a822c2de244f8becf43089c87Jean-Baptiste Querupackage com.android.provision; 18c4a805bf940c808a822c2de244f8becf43089c87Jean-Baptiste Queru 19c4a805bf940c808a822c2de244f8becf43089c87Jean-Baptiste Queruimport android.app.Activity; 20c4a805bf940c808a822c2de244f8becf43089c87Jean-Baptiste Queruimport android.content.ComponentName; 21c4a805bf940c808a822c2de244f8becf43089c87Jean-Baptiste Queruimport android.content.pm.PackageManager; 22c4a805bf940c808a822c2de244f8becf43089c87Jean-Baptiste Queruimport android.os.Bundle; 23c4a805bf940c808a822c2de244f8becf43089c87Jean-Baptiste Queruimport android.provider.Settings; 24c4a805bf940c808a822c2de244f8becf43089c87Jean-Baptiste Queru 25c4a805bf940c808a822c2de244f8becf43089c87Jean-Baptiste Queru/** 26c4a805bf940c808a822c2de244f8becf43089c87Jean-Baptiste Queru * Application that sets the provisioned bit, like SetupWizard does. 27c4a805bf940c808a822c2de244f8becf43089c87Jean-Baptiste Queru */ 28c4a805bf940c808a822c2de244f8becf43089c87Jean-Baptiste Querupublic class DefaultActivity extends Activity { 29c4a805bf940c808a822c2de244f8becf43089c87Jean-Baptiste Queru 30c4a805bf940c808a822c2de244f8becf43089c87Jean-Baptiste Queru @Override 31c4a805bf940c808a822c2de244f8becf43089c87Jean-Baptiste Queru protected void onCreate(Bundle icicle) { 32c4a805bf940c808a822c2de244f8becf43089c87Jean-Baptiste Queru super.onCreate(icicle); 33c4a805bf940c808a822c2de244f8becf43089c87Jean-Baptiste Queru 34c4a805bf940c808a822c2de244f8becf43089c87Jean-Baptiste Queru // Add a persistent setting to allow other apps to know the device has been provisioned. 3510c3003a034b9c18b7d17e967135088b95b9ca31Jeff Brown Settings.Global.putInt(getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 1); 367bc5587cab718f144deb46a5056d4ebd01a58a91Jean-Baptiste Queru Settings.Secure.putInt(getContentResolver(), Settings.Secure.USER_SETUP_COMPLETE, 1); 37c4a805bf940c808a822c2de244f8becf43089c87Jean-Baptiste Queru 38c4a805bf940c808a822c2de244f8becf43089c87Jean-Baptiste Queru // remove this activity from the package manager. 39c4a805bf940c808a822c2de244f8becf43089c87Jean-Baptiste Queru PackageManager pm = getPackageManager(); 40c4a805bf940c808a822c2de244f8becf43089c87Jean-Baptiste Queru ComponentName name = new ComponentName(this, DefaultActivity.class); 4186bf6d8ac38de74b1bead64ac26fe5130dfffbf5Dianne Hackborn pm.setComponentEnabledSetting(name, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 4286bf6d8ac38de74b1bead64ac26fe5130dfffbf5Dianne Hackborn PackageManager.DONT_KILL_APP); 43c4a805bf940c808a822c2de244f8becf43089c87Jean-Baptiste Queru 44c4a805bf940c808a822c2de244f8becf43089c87Jean-Baptiste Queru // terminate the activity. 45c4a805bf940c808a822c2de244f8becf43089c87Jean-Baptiste Queru finish(); 46c4a805bf940c808a822c2de244f8becf43089c87Jean-Baptiste Queru } 47c4a805bf940c808a822c2de244f8becf43089c87Jean-Baptiste Queru} 48c4a805bf940c808a822c2de244f8becf43089c87Jean-Baptiste Queru 49