HfaActivation should support UI and no-UI modes.
Split out the HFA logic into it's own class.
Created two new classes that use the logic: HfaService and HfaActivity.
HfaService is run during setupwizard and is completely without UI.
HfaActivity is rung during activations outside of setup wizard and
uses dialogs for the UI, which provice the user the ability to skip the
provisioning if desired (just as before).
We finish the primary activity (InCallScreenShowActivation.java)
immediately when we get the request and continue the new
activity/service as a new task.
bug:10655576
Change-Id: I9b83d4253168829c82c6a1d147ac4eb25a76f39f
diff --git a/src/com/android/phone/HfaService.java b/src/com/android/phone/HfaService.java
new file mode 100644
index 0000000..a4d13f2
--- /dev/null
+++ b/src/com/android/phone/HfaService.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2013 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.phone;
+
+import android.app.Service;
+import android.content.Intent;
+import android.os.IBinder;
+import android.util.Log;
+
+/**
+ * Service for performing HfaActivation without any UI.
+ */
+public class HfaService extends Service {
+ private static final String TAG = HfaService.class.getSimpleName();
+
+ @Override
+ public void onCreate() {
+ new HfaLogic(this, new HfaLogic.HfaLogicCallback() {
+ @Override
+ public void onSuccess() {
+ Log.i(TAG, "onSuccess");
+ onComplete();
+ }
+
+ @Override
+ public void onError(String msg) {
+ Log.i(TAG, "onError: " + msg);
+ // We do not respond from this service. On success or failure
+ // we do the same thing...finish.
+ onComplete();
+ }
+ }).start();
+
+ Log.i(TAG, "service started");
+ }
+
+ @Override
+ public IBinder onBind(Intent intent) {
+ return null;
+ }
+
+ private void onComplete() {
+ stopSelf();
+ }
+}