Merge "Remove telephony hidden api usages from commands"
am: e07c943cfd
Change-Id: I439df24d973dce041a4ed8d1659737973548c130
This commit is contained in:
@@ -16,10 +16,12 @@
|
|||||||
|
|
||||||
package com.android.commands.telecom;
|
package com.android.commands.telecom;
|
||||||
|
|
||||||
|
import android.app.ActivityThread;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.IUserManager;
|
import android.os.IUserManager;
|
||||||
|
import android.os.Looper;
|
||||||
import android.os.Process;
|
import android.os.Process;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.os.ServiceManager;
|
import android.os.ServiceManager;
|
||||||
@@ -33,7 +35,6 @@ import android.text.TextUtils;
|
|||||||
|
|
||||||
import com.android.internal.os.BaseCommand;
|
import com.android.internal.os.BaseCommand;
|
||||||
import com.android.internal.telecom.ITelecomService;
|
import com.android.internal.telecom.ITelecomService;
|
||||||
import com.android.internal.telephony.ITelephony;
|
|
||||||
import com.android.internal.telephony.TelephonyProperties;
|
import com.android.internal.telephony.TelephonyProperties;
|
||||||
|
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
@@ -83,7 +84,7 @@ public final class Telecom extends BaseCommand {
|
|||||||
private ComponentName mComponent;
|
private ComponentName mComponent;
|
||||||
private String mAccountId;
|
private String mAccountId;
|
||||||
private ITelecomService mTelecomService;
|
private ITelecomService mTelecomService;
|
||||||
private ITelephony mTelephonyService;
|
private TelephonyManager mTelephonyManager;
|
||||||
private IUserManager mUserManager;
|
private IUserManager mUserManager;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -154,9 +155,10 @@ public final class Telecom extends BaseCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mTelephonyService = ITelephony.Stub.asInterface(
|
Looper.prepareMainLooper();
|
||||||
ServiceManager.getService(Context.TELEPHONY_SERVICE));
|
Context context = ActivityThread.systemMain().getSystemContext();
|
||||||
if (mTelephonyService == null) {
|
mTelephonyManager = context.getSystemService(TelephonyManager.class);
|
||||||
|
if (mTelephonyManager == null) {
|
||||||
Log.w(this, "onRun: Can't access telephony service.");
|
Log.w(this, "onRun: Can't access telephony service.");
|
||||||
showError("Error: Could not access the Telephony Service. Is the system running?");
|
showError("Error: Could not access the Telephony Service. Is the system running?");
|
||||||
return;
|
return;
|
||||||
@@ -352,7 +354,7 @@ public final class Telecom extends BaseCommand {
|
|||||||
}
|
}
|
||||||
int numSims = Integer.parseInt(nextArgRequired());
|
int numSims = Integer.parseInt(nextArgRequired());
|
||||||
System.out.println("Setting sim count to " + numSims + ". Device may reboot");
|
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 {
|
private void runGetMaxPhones() throws RemoteException {
|
||||||
// This assumes the max number of SIMs is 2, which it currently is
|
// This assumes the max number of SIMs is 2, which it currently is
|
||||||
if (TelephonyManager.MULTISIM_ALLOWED
|
if (TelephonyManager.MULTISIM_ALLOWED == mTelephonyManager.isMultiSimSupported()) {
|
||||||
== mTelephonyService.isMultiSimSupported("com.android.commands.telecom")) {
|
|
||||||
System.out.println("2");
|
System.out.println("2");
|
||||||
} else {
|
} else {
|
||||||
System.out.println("1");
|
System.out.println("1");
|
||||||
|
|||||||
Reference in New Issue
Block a user