diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2017-05-15 23:21:05 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2017-05-15 23:21:06 +0000 |
commit | 0c9dbf507b53a12bdf577ff3e55c1686a2e089de (patch) | |
tree | 3849f2add85d7abe11151436b3f03f99783157a8 /java/com/android/voicemail/impl/ActivationTask.java | |
parent | e724c7b6376be660abf2113f97c7cbfc34515da8 (diff) | |
parent | c857f90590e7d7fcffa89511982eb33afd34805f (diff) |
Merge "Update Dialer to v10 RC32" into oc-dev
Diffstat (limited to 'java/com/android/voicemail/impl/ActivationTask.java')
-rw-r--r-- | java/com/android/voicemail/impl/ActivationTask.java | 49 |
1 files changed, 1 insertions, 48 deletions
diff --git a/java/com/android/voicemail/impl/ActivationTask.java b/java/com/android/voicemail/impl/ActivationTask.java index 91e369531..6e27b5015 100644 --- a/java/com/android/voicemail/impl/ActivationTask.java +++ b/java/com/android/voicemail/impl/ActivationTask.java @@ -19,11 +19,9 @@ package com.android.voicemail.impl; import android.annotation.TargetApi; import android.content.Context; import android.content.Intent; -import android.database.ContentObserver; import android.os.Build.VERSION_CODES; import android.os.Bundle; import android.provider.Settings; -import android.provider.Settings.Global; import android.support.annotation.Nullable; import android.support.annotation.WorkerThread; import android.telecom.PhoneAccountHandle; @@ -43,8 +41,6 @@ import com.android.voicemail.impl.sync.SyncTask; import com.android.voicemail.impl.sync.VvmAccountManager; import com.android.voicemail.impl.utils.LoggerUtils; import java.io.IOException; -import java.util.HashSet; -import java.util.Set; import java.util.concurrent.CancellationException; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; @@ -67,8 +63,6 @@ public class ActivationTask extends BaseTask { private static final String EXTRA_MESSAGE_DATA_BUNDLE = "extra_message_data_bundle"; - @Nullable private static DeviceProvisionedObserver sDeviceProvisionedObserver; - private final RetryPolicy mRetryPolicy; private Bundle mMessageData; @@ -98,7 +92,7 @@ public class ActivationTask extends BaseTask { // Activation might need information such as system language to be set, so wait until // the setup wizard is finished. The data bundle from the SMS will be re-requested upon // activation. - queueActivationAfterProvisioned(context, phoneAccountHandle); + DeviceProvisionedJobService.activateAfterProvisioned(context, phoneAccountHandle); return; } @@ -285,45 +279,4 @@ public class ActivationTask extends BaseTask { .createForPhoneAccountHandle(phoneAccountHandle); return telephonyManager.getServiceState().getState() == ServiceState.STATE_IN_SERVICE; } - - private static void queueActivationAfterProvisioned( - Context context, PhoneAccountHandle phoneAccountHandle) { - if (sDeviceProvisionedObserver == null) { - sDeviceProvisionedObserver = new DeviceProvisionedObserver(context); - context - .getContentResolver() - .registerContentObserver( - Settings.Global.getUriFor(Global.DEVICE_PROVISIONED), - false, - sDeviceProvisionedObserver); - } - sDeviceProvisionedObserver.addPhoneAcountHandle(phoneAccountHandle); - } - - private static class DeviceProvisionedObserver extends ContentObserver { - - private final Context mContext; - private final Set<PhoneAccountHandle> mPhoneAccountHandles = new HashSet<>(); - - private DeviceProvisionedObserver(Context context) { - super(null); - mContext = context; - } - - public void addPhoneAcountHandle(PhoneAccountHandle phoneAccountHandle) { - mPhoneAccountHandles.add(phoneAccountHandle); - } - - @Override - public void onChange(boolean selfChange) { - if (isDeviceProvisioned(mContext)) { - VvmLog.i(TAG, "device provisioned, resuming activation"); - for (PhoneAccountHandle phoneAccountHandle : mPhoneAccountHandles) { - start(mContext, phoneAccountHandle, null); - } - mContext.getContentResolver().unregisterContentObserver(sDeviceProvisionedObserver); - sDeviceProvisionedObserver = null; - } - } - } } |