Merge "revert deprecated sim activation logic"
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 0c82717..febb6e4 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -327,18 +327,6 @@
             </intent-filter>
         </activity>
 
-        <!-- Trampoline activity that handles the SIM_ACTIVATION_REQUEST intent. -->
-        <activity android:name="com.android.services.telephony.activation.SimActivationActivity"
-                android:permission="android.permission.PERFORM_SIM_ACTIVATION"
-                android:label="@string/phoneIconLabel"
-                android:theme="@android:style/Theme.NoDisplay"
-                android:excludeFromRecents="true">
-            <intent-filter>
-                <action android:name="android.intent.action.SIM_ACTIVATION_REQUEST" />
-                <category android:name="android.intent.category.DEFAULT" />
-            </intent-filter>
-        </activity>
-
         <!-- "Mobile network settings" screen, used on both
              non-voice-capable tablets and regular phone devices. -->
         <activity android:name="MobileNetworkSettings"
diff --git a/src/com/android/phone/PhoneGlobals.java b/src/com/android/phone/PhoneGlobals.java
index f45fb94..cec5a76 100644
--- a/src/com/android/phone/PhoneGlobals.java
+++ b/src/com/android/phone/PhoneGlobals.java
@@ -57,7 +57,6 @@
 import com.android.internal.telephony.TelephonyIntents;
 import com.android.phone.common.CallLogAsync;
 import com.android.phone.settings.SettingsConstants;
-import com.android.services.telephony.activation.SimActivationManager;
 import com.android.services.telephony.sip.SipUtil;
 
 /**
@@ -129,7 +128,6 @@
     CallerInfoCache callerInfoCache;
     NotificationMgr notificationMgr;
     public PhoneInterfaceManager phoneMgr;
-    public SimActivationManager simActivationManager;
     CarrierConfigLoader configLoader;
 
     private CallGatewayManager callGatewayManager;
@@ -373,8 +371,6 @@
         cdmaOtaScreenState = new OtaUtils.CdmaOtaScreenState();
         cdmaOtaInCallScreenUiState = new OtaUtils.CdmaOtaInCallScreenUiState();
 
-        simActivationManager = new SimActivationManager();
-
         // XXX pre-load the SimProvider so that it's ready
         resolver.getType(Uri.parse("content://icc/adn"));
 
diff --git a/src/com/android/services/telephony/activation/Activator.java b/src/com/android/services/telephony/activation/Activator.java
deleted file mode 100644
index 7dee5b3..0000000
--- a/src/com/android/services/telephony/activation/Activator.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.services.telephony.activation;
-
-/**
- * SIM Activation implementation generic interface.
- */
-public interface Activator {
-    void onActivate();
-}
diff --git a/src/com/android/services/telephony/activation/OtaspActivator.java b/src/com/android/services/telephony/activation/OtaspActivator.java
deleted file mode 100644
index 11ba726..0000000
--- a/src/com/android/services/telephony/activation/OtaspActivator.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.services.telephony.activation;
-
-/**
- * Over-The-Air SIM Provisioning (OTASP) activation implementation.
- *
- * Handles OTASP activation requests and returns status updates as activation progresses.
- */
-public class OtaspActivator implements Activator {
-    @Override
-    public void onActivate() {
-        // TODO: handle otasp activation
-    }
-}
diff --git a/src/com/android/services/telephony/activation/SimActivationActivity.java b/src/com/android/services/telephony/activation/SimActivationActivity.java
deleted file mode 100644
index ae11a3f..0000000
--- a/src/com/android/services/telephony/activation/SimActivationActivity.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.services.telephony.activation;
-
-import android.app.Activity;
-import android.app.PendingIntent;
-import android.app.PendingIntent.CanceledException;
-import android.content.Intent;
-import android.os.Bundle;
-import android.telephony.TelephonyManager;
-
-import com.android.phone.PhoneGlobals;
-import com.android.services.telephony.Log;
-
-/**
- * Invisible activity that handles the android.intent.action.SIM_ACTIVATION_REQUEST intent.
- * This activity is protected by the android.permission.PERFORM_SIM_ACTIVATION permission.
- */
-public class SimActivationActivity extends Activity {
-    @Override
-    protected void onCreate(Bundle icicle) {
-        super.onCreate(icicle);
-        Log.i(this, "onCreate");
-
-        Intent intent = getIntent();
-        if (Intent.ACTION_SIM_ACTIVATION_REQUEST.equals(intent.getAction())) {
-            Log.i(this, "Activation requested " + intent);
-
-            runActivation(intent);
-        }
-        finish();
-    }
-
-    private void runActivation(Intent intent) {
-        final PendingIntent response =
-                intent.getParcelableExtra(Intent.EXTRA_SIM_ACTIVATION_RESPONSE);
-
-        Log.i(this, "Running activation w/ response " + response);
-
-        PhoneGlobals app = PhoneGlobals.getInstance();
-        app.simActivationManager.runActivation(SimActivationManager.Triggers.EXPLICIT_REQUEST,
-                new SimActivationManager.Response() {
-                    @Override
-                    public void onResponse(int status) {
-                        if (response != null) {
-                            try {
-                                response.send();
-                            } catch (CanceledException e) {
-                                Log.w(this, "Could not respond to SIM Activation.");
-                            }
-                        }
-                    }
-                });
-
-        // TODO: Set this status to the return value of runActivation
-        // Return the response as an activity result and the pending intent.
-        setResult(TelephonyManager.SIM_ACTIVATION_RESULT_IN_PROGRESS);
-    }
-}
diff --git a/src/com/android/services/telephony/activation/SimActivationManager.java b/src/com/android/services/telephony/activation/SimActivationManager.java
deleted file mode 100644
index ce9e508..0000000
--- a/src/com/android/services/telephony/activation/SimActivationManager.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.services.telephony.activation;
-
-import android.app.PendingIntent;
-import android.telephony.TelephonyManager;
-
-/**
- * Handles SIM activation requests and runs the appropriate activation process until it completes
- * or fails. When done, sends back a response if needed.
- */
-public class SimActivationManager {
-    public static final class Triggers {
-        public static final int SYSTEM_START = 1;
-        public static final int EXPLICIT_REQUEST = 2;
-    }
-
-    public interface Response {
-        /**
-         * @param status See {@link android.telephony.TelephonyManager} for SIM_ACTIVATION_RESULT_*
-         *               constants.
-         */
-        void onResponse(int status);
-    }
-
-    public void runActivation(int trigger, Response response) {
-        Activator activator = selectActivator(trigger);
-
-        activator.onActivate();
-
-        // TODO: Specify some way to determine if activation is even necessary.
-
-        // TODO: specify some way to return the result.
-
-        if (response != null) {
-            response.onResponse(TelephonyManager.SIM_ACTIVATION_RESULT_COMPLETE);
-        }
-    }
-
-    private Activator selectActivator(int trigger) {
-        // TODO: Select among all activator types
-
-        // For now, pick a do-nothing activator
-        return new Activator() {
-
-            /** ${inheritDoc} */
-                @Override
-            public void onActivate() {
-                // do something
-            }
-        };
-    }
-}
diff --git a/tests/AndroidManifest.xml b/tests/AndroidManifest.xml
index cae4c1b..7962738 100644
--- a/tests/AndroidManifest.xml
+++ b/tests/AndroidManifest.xml
@@ -19,7 +19,6 @@
 
     <uses-permission android:name="android.permission.CALL_PHONE" />
     <uses-permission android:name="android.permission.PERFORM_CDMA_PROVISIONING" />
-    <uses-permission android:name="android.permission.PERFORM_SIM_ACTIVATION" />
 
     <application android:label="@string/app_name">
         <uses-library android:name="android.test.runner" />
diff --git a/tests/src/com/android/services/telephony/activation/ResponseReceiver.java b/tests/src/com/android/services/telephony/activation/ResponseReceiver.java
deleted file mode 100644
index 33e7f00..0000000
--- a/tests/src/com/android/services/telephony/activation/ResponseReceiver.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.services.telephony.activation;
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-
-import com.android.services.telephony.Log;
-
-public class ResponseReceiver extends BroadcastReceiver {
-    volatile public static boolean responseReceived = false;
-    public static final String ACTION_ACTIVATION_RESPONSE =
-            "com.android.services.telephony.ACTIVATION_RESPONSE";
-
-    private final Object mLock;
-    private Context mContext;
-
-    ResponseReceiver(Object lock) {
-        mLock = lock;
-    }
-
-    /** ${inheritDoc} */
-    @Override
-    public void onReceive(Context context, Intent intent) {
-        if (!ACTION_ACTIVATION_RESPONSE.equals(intent.getAction())) {
-            Log.e(this, null, "Unexpected intent: " + intent.getAction());
-            return;
-        }
-
-        responseReceived = true;
-        Log.i(this, "received intent");
-
-        if (mLock != null) {
-            synchronized(mLock) {
-                Log.i(this, "notifying");
-                mLock.notify();
-            }
-        }
-    }
-
-    void register(Context context) {
-        context.registerReceiver(this, new IntentFilter(ACTION_ACTIVATION_RESPONSE));
-        mContext = context;
-    }
-
-    void unregister() {
-        mContext.unregisterReceiver(this);
-    }
-}
diff --git a/tests/src/com/android/services/telephony/activation/SimActivationTest.java b/tests/src/com/android/services/telephony/activation/SimActivationTest.java
deleted file mode 100644
index f6060dc..0000000
--- a/tests/src/com/android/services/telephony/activation/SimActivationTest.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.services.telephony.activation;
-
-import android.app.PendingIntent;
-import android.content.Context;
-import android.content.Intent;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.SmallTest;
-
-import com.android.services.telephony.Log;
-
-public class SimActivationTest extends AndroidTestCase {
-
-    private static Object mActivationLock = new Object();
-    private ResponseReceiver mResponseReceiver;
-
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-
-        mResponseReceiver = new ResponseReceiver(mActivationLock);
-        mResponseReceiver.register(context());
-    }
-
-    /** ${inheritDoc} */
-    @Override
-    protected void tearDown() throws Exception {
-        mResponseReceiver.unregister();
-        super.tearDown();
-    }
-
-    @SmallTest
-    public void testSimActivationResponse() throws Exception {
-        Log.i(this, "Running activation test");
-
-        Intent responseIntent = new Intent(ResponseReceiver.ACTION_ACTIVATION_RESPONSE);
-        responseIntent.setPackage(context().getPackageName());
-        PendingIntent pendingResponse = PendingIntent.getBroadcast(
-                context(), 0, responseIntent, 0);
-
-        Intent intent = new Intent(Intent.ACTION_SIM_ACTIVATION_REQUEST);
-        intent.putExtra(Intent.EXTRA_SIM_ACTIVATION_RESPONSE, pendingResponse);
-        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-
-        Log.i(this, "sent intent");
-        context().startActivity(intent);
-        synchronized (mActivationLock) {
-            Log.i(this, "waiting ");
-            mActivationLock.wait(5000);
-            Log.i(this, "unwaiting");
-        }
-        assertTrue(ResponseReceiver.responseReceived);
-    }
-
-    private Context context() {
-        return getContext();
-    }
-}