diff options
| author | 2019-12-05 19:19:46 -0800 | |
|---|---|---|
| committer | 2019-12-05 19:19:46 -0800 | |
| commit | a2a1150aa8da7f988162d2ca41d0624f43fd5c7d (patch) | |
| tree | 2bffde3d9d29a8a76afb2825dd1ceb2fd3c18298 | |
| parent | 7232ba49c81f10fd9c21574af01d3a33db698a5c (diff) | |
| parent | 798e77ff7757b7119dca2ea527e973b523e185c9 (diff) | |
Merge "Remove telephony hidden api usages from commands" am: e07c943cfd
am: 798e77ff77
Change-Id: I2cf125ea80b0c27abe9e5f415aa1c71d688967f1
| -rw-r--r-- | cmds/telecom/src/com/android/commands/telecom/Telecom.java | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/cmds/telecom/src/com/android/commands/telecom/Telecom.java b/cmds/telecom/src/com/android/commands/telecom/Telecom.java index 5ffe2f2c2766..9061ed1d48af 100644 --- a/cmds/telecom/src/com/android/commands/telecom/Telecom.java +++ b/cmds/telecom/src/com/android/commands/telecom/Telecom.java @@ -16,10 +16,12 @@ package com.android.commands.telecom; +import android.app.ActivityThread; import android.content.ComponentName; import android.content.Context; import android.net.Uri; import android.os.IUserManager; +import android.os.Looper; import android.os.Process; import android.os.RemoteException; import android.os.ServiceManager; @@ -33,7 +35,6 @@ import android.text.TextUtils; import com.android.internal.os.BaseCommand; import com.android.internal.telecom.ITelecomService; -import com.android.internal.telephony.ITelephony; import com.android.internal.telephony.TelephonyProperties; import java.io.PrintStream; @@ -83,7 +84,7 @@ public final class Telecom extends BaseCommand { private ComponentName mComponent; private String mAccountId; private ITelecomService mTelecomService; - private ITelephony mTelephonyService; + private TelephonyManager mTelephonyManager; private IUserManager mUserManager; @Override @@ -154,9 +155,10 @@ public final class Telecom extends BaseCommand { return; } - mTelephonyService = ITelephony.Stub.asInterface( - ServiceManager.getService(Context.TELEPHONY_SERVICE)); - if (mTelephonyService == null) { + Looper.prepareMainLooper(); + Context context = ActivityThread.systemMain().getSystemContext(); + mTelephonyManager = context.getSystemService(TelephonyManager.class); + if (mTelephonyManager == null) { Log.w(this, "onRun: Can't access telephony service."); showError("Error: Could not access the Telephony Service. Is the system running?"); return; @@ -352,7 +354,7 @@ public final class Telecom extends BaseCommand { } int numSims = Integer.parseInt(nextArgRequired()); System.out.println("Setting sim count to " + numSims + ". Device may reboot"); - mTelephonyService.switchMultiSimConfig(numSims); + mTelephonyManager.switchMultiSimConfig(numSims); } /** @@ -366,8 +368,7 @@ public final class Telecom extends BaseCommand { private void runGetMaxPhones() throws RemoteException { // This assumes the max number of SIMs is 2, which it currently is - if (TelephonyManager.MULTISIM_ALLOWED - == mTelephonyService.isMultiSimSupported("com.android.commands.telecom")) { + if (TelephonyManager.MULTISIM_ALLOWED == mTelephonyManager.isMultiSimSupported()) { System.out.println("2"); } else { System.out.println("1"); |