diff options
author | Malcolm Chen <refuhoo@google.com> | 2020-01-08 15:53:02 -0800 |
---|---|---|
committer | Malcolm Chen <refuhoo@google.com> | 2020-01-10 16:39:36 -0800 |
commit | 93fcf24a237842f87a9bd86664cb8d188b1d069c (patch) | |
tree | 2da20442993a7a9d2245c6e285a14ba8727eb925 /packages/CarrierDefaultApp | |
parent | 85e2fafccdef50ee1bd219d19a682a4b6f5cda14 (diff) |
Move ACTION_CARRIER_* intent and extras from TelephonyIntents to
TelephonyManager.
The purpose is to expose them as @SystemApi as they are used externally.
Bug: 140908357
Test: unittest
Change-Id: I3dabcb853ebbd648b20d97b446db11476780be25
Diffstat (limited to 'packages/CarrierDefaultApp')
4 files changed, 20 insertions, 21 deletions
diff --git a/packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/CaptivePortalLoginActivity.java b/packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/CaptivePortalLoginActivity.java index 642dc82c4d28..41a9b24afa03 100644 --- a/packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/CaptivePortalLoginActivity.java +++ b/packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/CaptivePortalLoginActivity.java @@ -36,6 +36,7 @@ import android.net.http.SslError; import android.os.Bundle; import android.telephony.CarrierConfigManager; import android.telephony.SubscriptionManager; +import android.telephony.TelephonyManager; import android.text.TextUtils; import android.util.ArrayMap; import android.util.Log; @@ -49,7 +50,6 @@ import android.widget.ProgressBar; import android.widget.TextView; import com.android.internal.telephony.PhoneConstants; -import com.android.internal.telephony.TelephonyIntents; import com.android.internal.util.ArrayUtils; import com.android.internal.util.TrafficStatsConstants; @@ -203,7 +203,7 @@ public class CaptivePortalLoginActivity extends Activity { } private URL getUrlForCaptivePortal() { - String url = getIntent().getStringExtra(TelephonyIntents.EXTRA_REDIRECTION_URL_KEY); + String url = getIntent().getStringExtra(TelephonyManager.EXTRA_REDIRECTION_URL); if (TextUtils.isEmpty(url)) url = mCm.getCaptivePortalServerUrl(); final CarrierConfigManager configManager = getApplicationContext() .getSystemService(CarrierConfigManager.class); diff --git a/packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/CustomConfigLoader.java b/packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/CustomConfigLoader.java index 46b1d5fe27be..c7f5e9a5ceec 100644 --- a/packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/CustomConfigLoader.java +++ b/packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/CustomConfigLoader.java @@ -19,10 +19,10 @@ import android.content.Context; import android.content.Intent; import android.os.PersistableBundle; import android.telephony.CarrierConfigManager; +import android.telephony.TelephonyManager; import android.text.TextUtils; import android.util.Log; -import com.android.internal.telephony.TelephonyIntents; import com.android.internal.util.ArrayUtils; import java.util.ArrayList; @@ -50,7 +50,7 @@ public class CustomConfigLoader { * @param intent passing signal for config match * @return a list of carrier action for the given signal based on the carrier config. * - * Example: input intent TelephonyIntent.ACTION_CARRIER_SIGNAL_REQUEST_NETWORK_FAILED + * Example: input intent TelephonyManager.ACTION_CARRIER_SIGNAL_REQUEST_NETWORK_FAILED * This intent allows fined-grained matching based on both intent type & extra values: * apnType and errorCode. * apnType read from passing intent is "default" and errorCode is 0x26 for example and @@ -78,25 +78,25 @@ public class CustomConfigLoader { String arg1 = null; String arg2 = null; switch (intent.getAction()) { - case TelephonyIntents.ACTION_CARRIER_SIGNAL_REDIRECTED: + case TelephonyManager.ACTION_CARRIER_SIGNAL_REDIRECTED: configs = b.getStringArray(CarrierConfigManager .KEY_CARRIER_DEFAULT_ACTIONS_ON_REDIRECTION_STRING_ARRAY); break; - case TelephonyIntents.ACTION_CARRIER_SIGNAL_REQUEST_NETWORK_FAILED: + case TelephonyManager.ACTION_CARRIER_SIGNAL_REQUEST_NETWORK_FAILED: configs = b.getStringArray(CarrierConfigManager .KEY_CARRIER_DEFAULT_ACTIONS_ON_DCFAILURE_STRING_ARRAY); - arg1 = intent.getStringExtra(TelephonyIntents.EXTRA_APN_TYPE_KEY); - arg2 = intent.getStringExtra(TelephonyIntents.EXTRA_ERROR_CODE_KEY); + arg1 = intent.getStringExtra(TelephonyManager.EXTRA_APN_TYPE); + arg2 = intent.getStringExtra(TelephonyManager.EXTRA_ERROR_CODE); break; - case TelephonyIntents.ACTION_CARRIER_SIGNAL_RESET: + case TelephonyManager.ACTION_CARRIER_SIGNAL_RESET: configs = b.getStringArray(CarrierConfigManager .KEY_CARRIER_DEFAULT_ACTIONS_ON_RESET); break; - case TelephonyIntents.ACTION_CARRIER_SIGNAL_DEFAULT_NETWORK_AVAILABLE: + case TelephonyManager.ACTION_CARRIER_SIGNAL_DEFAULT_NETWORK_AVAILABLE: configs = b.getStringArray(CarrierConfigManager .KEY_CARRIER_DEFAULT_ACTIONS_ON_DEFAULT_NETWORK_AVAILABLE); - arg1 = String.valueOf(intent.getBooleanExtra(TelephonyIntents - .EXTRA_DEFAULT_NETWORK_AVAILABLE_KEY, false)); + arg1 = String.valueOf(intent.getBooleanExtra(TelephonyManager + .EXTRA_DEFAULT_NETWORK_AVAILABLE, false)); break; default: Log.e(TAG, "load carrier config failure with un-configured key: " diff --git a/packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/ProvisionObserver.java b/packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/ProvisionObserver.java index 3e34f0aa6124..78a02d71fc9f 100644 --- a/packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/ProvisionObserver.java +++ b/packages/CarrierDefaultApp/src/com/android/carrierdefaultapp/ProvisionObserver.java @@ -27,10 +27,9 @@ import android.net.ConnectivityManager; import android.net.Network; import android.net.NetworkCapabilities; import android.provider.Settings; +import android.telephony.TelephonyManager; import android.util.Log; -import com.android.internal.telephony.TelephonyIntents; - /** * Service to run {@link android.app.job.JobScheduler} job. * Service to monitor when there is a change to conent URI @@ -93,7 +92,7 @@ public class ProvisionObserver extends JobService { } int jobId; switch(intent.getAction()) { - case TelephonyIntents.ACTION_CARRIER_SIGNAL_REDIRECTED: + case TelephonyManager.ACTION_CARRIER_SIGNAL_REDIRECTED: jobId = PROVISION_OBSERVER_REEVALUATION_JOB_ID; break; default: diff --git a/packages/CarrierDefaultApp/tests/unit/src/com/android/carrierdefaultapp/CarrierDefaultReceiverTest.java b/packages/CarrierDefaultApp/tests/unit/src/com/android/carrierdefaultapp/CarrierDefaultReceiverTest.java index 1928ad9add3e..086a287fd243 100644 --- a/packages/CarrierDefaultApp/tests/unit/src/com/android/carrierdefaultapp/CarrierDefaultReceiverTest.java +++ b/packages/CarrierDefaultApp/tests/unit/src/com/android/carrierdefaultapp/CarrierDefaultReceiverTest.java @@ -15,6 +15,11 @@ */ package com.android.carrierdefaultapp; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; @@ -25,7 +30,6 @@ import android.telephony.TelephonyManager; import android.test.InstrumentationTestCase; import com.android.internal.telephony.PhoneConstants; -import com.android.internal.telephony.TelephonyIntents; import org.junit.After; import org.junit.Before; @@ -34,10 +38,6 @@ import org.mockito.ArgumentCaptor; import org.mockito.Captor; import org.mockito.Mock; import org.mockito.MockitoAnnotations; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; public class CarrierDefaultReceiverTest extends InstrumentationTestCase { @Mock @@ -87,7 +87,7 @@ public class CarrierDefaultReceiverTest extends InstrumentationTestCase { .KEY_CARRIER_DEFAULT_ACTIONS_ON_REDIRECTION_STRING_ARRAY, new String[]{"4,1"}); doReturn(b).when(mCarrierConfigMgr).getConfig(); - Intent intent = new Intent(TelephonyIntents.ACTION_CARRIER_SIGNAL_REDIRECTED); + Intent intent = new Intent(TelephonyManager.ACTION_CARRIER_SIGNAL_REDIRECTED); intent.putExtra(PhoneConstants.SUBSCRIPTION_KEY, subId); mReceiver.onReceive(mContext, intent); |