diff options
author | Eric Erfanian <erfanian@google.com> | 2017-05-16 00:09:31 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-05-16 00:09:31 +0000 |
commit | c57430a61eab62e88372f386c75989dab6332608 (patch) | |
tree | b606f1899f80fcd0ea3ee753ce799883d5a673ab /java/com/android/voicemail/impl/ActivationTask.java | |
parent | 9842b4a7fd1d852b1353af806da4913b4298d516 (diff) | |
parent | 0c9dbf507b53a12bdf577ff3e55c1686a2e089de (diff) |
Merge "Update Dialer to v10 RC32" into oc-dev
am: 0c9dbf507b
Change-Id: I5f90090090c6e430d83fcdd294082c1f5237ade8
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; - } - } - } } |