Loading cmds/telecom/src/com/android/commands/telecom/Telecom.java +9 −8 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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 java.io.PrintStream; Loading Loading @@ -82,7 +83,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 Loading Loading @@ -153,9 +154,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; Loading Loading @@ -351,7 +353,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); } /** Loading @@ -365,8 +367,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", null)) { if (TelephonyManager.MULTISIM_ALLOWED == mTelephonyManager.isMultiSimSupported()) { System.out.println("2"); } else { System.out.println("1"); Loading Loading
cmds/telecom/src/com/android/commands/telecom/Telecom.java +9 −8 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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 java.io.PrintStream; Loading Loading @@ -82,7 +83,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 Loading Loading @@ -153,9 +154,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; Loading Loading @@ -351,7 +353,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); } /** Loading @@ -365,8 +367,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", null)) { if (TelephonyManager.MULTISIM_ALLOWED == mTelephonyManager.isMultiSimSupported()) { System.out.println("2"); } else { System.out.println("1"); Loading