Merge "Fixed the obsolete logging" into oc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
93c2c94c19
@@ -32,37 +32,39 @@ import android.os.IBinder;
|
|||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.telephony.CellLocation;
|
|
||||||
import android.telephony.Rlog;
|
|
||||||
import android.telephony.TelephonyManager;
|
|
||||||
import android.telephony.SubscriptionManager;
|
|
||||||
import android.telephony.PhoneStateListener;
|
|
||||||
import android.telephony.ServiceState;
|
|
||||||
import android.telephony.SignalStrength;
|
|
||||||
import android.telephony.CellInfo;
|
import android.telephony.CellInfo;
|
||||||
import android.telephony.VoLteServiceState;
|
import android.telephony.CellLocation;
|
||||||
import android.telephony.DisconnectCause;
|
import android.telephony.DisconnectCause;
|
||||||
|
import android.telephony.PhoneStateListener;
|
||||||
import android.telephony.PreciseCallState;
|
import android.telephony.PreciseCallState;
|
||||||
import android.telephony.PreciseDataConnectionState;
|
import android.telephony.PreciseDataConnectionState;
|
||||||
import android.telephony.PreciseDisconnectCause;
|
import android.telephony.PreciseDisconnectCause;
|
||||||
|
import android.telephony.Rlog;
|
||||||
|
import android.telephony.ServiceState;
|
||||||
|
import android.telephony.SignalStrength;
|
||||||
|
import android.telephony.SubscriptionManager;
|
||||||
|
import android.telephony.TelephonyManager;
|
||||||
|
import android.telephony.VoLteServiceState;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.text.format.Time;
|
import android.util.LocalLog;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.io.FileDescriptor;
|
|
||||||
import java.io.PrintWriter;
|
|
||||||
|
|
||||||
import com.android.internal.app.IBatteryStats;
|
import com.android.internal.app.IBatteryStats;
|
||||||
import com.android.internal.telephony.IOnSubscriptionsChangedListener;
|
import com.android.internal.telephony.IOnSubscriptionsChangedListener;
|
||||||
import com.android.internal.telephony.ITelephonyRegistry;
|
|
||||||
import com.android.internal.telephony.IPhoneStateListener;
|
import com.android.internal.telephony.IPhoneStateListener;
|
||||||
|
import com.android.internal.telephony.ITelephonyRegistry;
|
||||||
import com.android.internal.telephony.PhoneConstantConversions;
|
import com.android.internal.telephony.PhoneConstantConversions;
|
||||||
import com.android.internal.telephony.PhoneConstants;
|
import com.android.internal.telephony.PhoneConstants;
|
||||||
import com.android.internal.telephony.TelephonyIntents;
|
import com.android.internal.telephony.TelephonyIntents;
|
||||||
import com.android.internal.util.DumpUtils;
|
import com.android.internal.util.DumpUtils;
|
||||||
|
import com.android.internal.util.IndentingPrintWriter;
|
||||||
import com.android.server.am.BatteryStatsService;
|
import com.android.server.am.BatteryStatsService;
|
||||||
|
|
||||||
|
import java.io.FileDescriptor;
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Since phone process can be restarted, this class provides a centralized place
|
* Since phone process can be restarted, this class provides a centralized place
|
||||||
* that applications can register and be called back from.
|
* that applications can register and be called back from.
|
||||||
@@ -159,8 +161,6 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
|
|
||||||
private String[] mDataConnectionReason;
|
private String[] mDataConnectionReason;
|
||||||
|
|
||||||
private String[] mDataConnectionApn;
|
|
||||||
|
|
||||||
private ArrayList<String>[] mConnectedApns;
|
private ArrayList<String>[] mConnectedApns;
|
||||||
|
|
||||||
private LinkProperties[] mDataConnectionLinkProperties;
|
private LinkProperties[] mDataConnectionLinkProperties;
|
||||||
@@ -191,6 +191,8 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
|
|
||||||
private boolean mCarrierNetworkChangeState = false;
|
private boolean mCarrierNetworkChangeState = false;
|
||||||
|
|
||||||
|
private final LocalLog mLocalLog = new LocalLog(100);
|
||||||
|
|
||||||
private PreciseDataConnectionState mPreciseDataConnectionState =
|
private PreciseDataConnectionState mPreciseDataConnectionState =
|
||||||
new PreciseDataConnectionState();
|
new PreciseDataConnectionState();
|
||||||
|
|
||||||
@@ -310,7 +312,6 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
mMessageWaiting = new boolean[numPhones];
|
mMessageWaiting = new boolean[numPhones];
|
||||||
mDataConnectionPossible = new boolean[numPhones];
|
mDataConnectionPossible = new boolean[numPhones];
|
||||||
mDataConnectionReason = new String[numPhones];
|
mDataConnectionReason = new String[numPhones];
|
||||||
mDataConnectionApn = new String[numPhones];
|
|
||||||
mCallForwarding = new boolean[numPhones];
|
mCallForwarding = new boolean[numPhones];
|
||||||
mCellLocation = new Bundle[numPhones];
|
mCellLocation = new Bundle[numPhones];
|
||||||
mDataConnectionLinkProperties = new LinkProperties[numPhones];
|
mDataConnectionLinkProperties = new LinkProperties[numPhones];
|
||||||
@@ -329,7 +330,6 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
mCallForwarding[i] = false;
|
mCallForwarding[i] = false;
|
||||||
mDataConnectionPossible[i] = false;
|
mDataConnectionPossible[i] = false;
|
||||||
mDataConnectionReason[i] = "";
|
mDataConnectionReason[i] = "";
|
||||||
mDataConnectionApn[i] = "";
|
|
||||||
mCellLocation[i] = new Bundle();
|
mCellLocation[i] = new Bundle();
|
||||||
mCellInfo.add(i, null);
|
mCellInfo.add(i, null);
|
||||||
mConnectedApns[i] = new ArrayList<String>();
|
mConnectedApns[i] = new ArrayList<String>();
|
||||||
@@ -536,7 +536,6 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
if (DBG) {
|
if (DBG) {
|
||||||
log("listen: Register r=" + r + " r.subId=" + r.subId + " phoneId=" + phoneId);
|
log("listen: Register r=" + r + " r.subId=" + r.subId + " phoneId=" + phoneId);
|
||||||
}
|
}
|
||||||
if (VDBG) toStringLogSSC("listen");
|
|
||||||
if (notifyNow && validatePhoneId(phoneId)) {
|
if (notifyNow && validatePhoneId(phoneId)) {
|
||||||
if ((events & PhoneStateListener.LISTEN_SERVICE_STATE) != 0) {
|
if ((events & PhoneStateListener.LISTEN_SERVICE_STATE) != 0) {
|
||||||
try {
|
try {
|
||||||
@@ -780,14 +779,14 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
}
|
}
|
||||||
|
|
||||||
synchronized (mRecords) {
|
synchronized (mRecords) {
|
||||||
|
String str = "notifyServiceStateForSubscriber: subId=" + subId + " phoneId=" + phoneId
|
||||||
|
+ " state=" + state;
|
||||||
if (VDBG) {
|
if (VDBG) {
|
||||||
log("notifyServiceStateForSubscriber: subId=" + subId + " phoneId=" + phoneId
|
log(str);
|
||||||
+ " state=" + state);
|
|
||||||
}
|
}
|
||||||
|
mLocalLog.log(str);
|
||||||
if (validatePhoneId(phoneId)) {
|
if (validatePhoneId(phoneId)) {
|
||||||
mServiceState[phoneId] = state;
|
mServiceState[phoneId] = state;
|
||||||
logServiceStateChanged("notifyServiceStateForSubscriber", subId, phoneId, state);
|
|
||||||
if (VDBG) toStringLogSSC("notifyServiceStateForSubscriber");
|
|
||||||
|
|
||||||
for (Record r : mRecords) {
|
for (Record r : mRecords) {
|
||||||
if (VDBG) {
|
if (VDBG) {
|
||||||
@@ -885,7 +884,6 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
if (VDBG) {
|
if (VDBG) {
|
||||||
log("notifySignalStrengthForPhoneId: subId=" + subId
|
log("notifySignalStrengthForPhoneId: subId=" + subId
|
||||||
+" phoneId=" + phoneId + " signalStrength=" + signalStrength);
|
+" phoneId=" + phoneId + " signalStrength=" + signalStrength);
|
||||||
toStringLogSSC("notifySignalStrengthForPhoneId");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized (mRecords) {
|
synchronized (mRecords) {
|
||||||
@@ -1137,18 +1135,20 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
modified = true;
|
modified = true;
|
||||||
}
|
}
|
||||||
if (modified) {
|
if (modified) {
|
||||||
if (DBG) {
|
String str = "onDataConnectionStateChanged(" + mDataConnectionState[phoneId]
|
||||||
log("onDataConnectionStateChanged(" + mDataConnectionState[phoneId]
|
+ ", " + mDataConnectionNetworkType[phoneId] + ")";
|
||||||
+ ", " + mDataConnectionNetworkType[phoneId] + ")");
|
log(str);
|
||||||
}
|
mLocalLog.log(str);
|
||||||
for (Record r : mRecords) {
|
for (Record r : mRecords) {
|
||||||
if (r.matchPhoneStateListenerEvent(
|
if (r.matchPhoneStateListenerEvent(
|
||||||
PhoneStateListener.LISTEN_DATA_CONNECTION_STATE) &&
|
PhoneStateListener.LISTEN_DATA_CONNECTION_STATE) &&
|
||||||
idMatch(r.subId, subId, phoneId)) {
|
idMatch(r.subId, subId, phoneId)) {
|
||||||
try {
|
try {
|
||||||
log("Notify data connection state changed on sub: " +
|
if (DBG) {
|
||||||
subId);
|
log("Notify data connection state changed on sub: " + subId);
|
||||||
r.callback.onDataConnectionStateChanged(mDataConnectionState[phoneId],
|
}
|
||||||
|
r.callback.onDataConnectionStateChanged(
|
||||||
|
mDataConnectionState[phoneId],
|
||||||
mDataConnectionNetworkType[phoneId]);
|
mDataConnectionNetworkType[phoneId]);
|
||||||
} catch (RemoteException ex) {
|
} catch (RemoteException ex) {
|
||||||
mRemoveList.add(r.binder);
|
mRemoveList.add(r.binder);
|
||||||
@@ -1163,7 +1163,8 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
if (r.matchPhoneStateListenerEvent(
|
if (r.matchPhoneStateListenerEvent(
|
||||||
PhoneStateListener.LISTEN_PRECISE_DATA_CONNECTION_STATE)) {
|
PhoneStateListener.LISTEN_PRECISE_DATA_CONNECTION_STATE)) {
|
||||||
try {
|
try {
|
||||||
r.callback.onPreciseDataConnectionStateChanged(mPreciseDataConnectionState);
|
r.callback.onPreciseDataConnectionStateChanged(
|
||||||
|
mPreciseDataConnectionState);
|
||||||
} catch (RemoteException ex) {
|
} catch (RemoteException ex) {
|
||||||
mRemoveList.add(r.binder);
|
mRemoveList.add(r.binder);
|
||||||
}
|
}
|
||||||
@@ -1391,36 +1392,58 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
|
public void dump(FileDescriptor fd, PrintWriter writer, String[] args) {
|
||||||
|
final IndentingPrintWriter pw = new IndentingPrintWriter(writer, " ");
|
||||||
|
|
||||||
if (!DumpUtils.checkDumpPermission(mContext, TAG, pw)) return;
|
if (!DumpUtils.checkDumpPermission(mContext, TAG, pw)) return;
|
||||||
|
|
||||||
synchronized (mRecords) {
|
synchronized (mRecords) {
|
||||||
final int recordCount = mRecords.size();
|
final int recordCount = mRecords.size();
|
||||||
pw.println("last known state:");
|
pw.println("last known state:");
|
||||||
|
pw.increaseIndent();
|
||||||
for (int i = 0; i < TelephonyManager.getDefault().getPhoneCount(); i++) {
|
for (int i = 0; i < TelephonyManager.getDefault().getPhoneCount(); i++) {
|
||||||
pw.println(" Phone Id=" + i);
|
pw.println("Phone Id=" + i);
|
||||||
pw.println(" mCallState=" + mCallState[i]);
|
pw.increaseIndent();
|
||||||
pw.println(" mCallIncomingNumber=" + mCallIncomingNumber[i]);
|
pw.println("mCallState=" + mCallState[i]);
|
||||||
pw.println(" mServiceState=" + mServiceState[i]);
|
pw.println("mCallIncomingNumber=" + mCallIncomingNumber[i]);
|
||||||
pw.println(" mVoiceActivationState= " + mVoiceActivationState[i]);
|
pw.println("mServiceState=" + mServiceState[i]);
|
||||||
pw.println(" mDataActivationState= " + mDataActivationState[i]);
|
pw.println("mVoiceActivationState= " + mVoiceActivationState[i]);
|
||||||
pw.println(" mSignalStrength=" + mSignalStrength[i]);
|
pw.println("mDataActivationState= " + mDataActivationState[i]);
|
||||||
pw.println(" mMessageWaiting=" + mMessageWaiting[i]);
|
pw.println("mSignalStrength=" + mSignalStrength[i]);
|
||||||
pw.println(" mCallForwarding=" + mCallForwarding[i]);
|
pw.println("mMessageWaiting=" + mMessageWaiting[i]);
|
||||||
pw.println(" mDataActivity=" + mDataActivity[i]);
|
pw.println("mCallForwarding=" + mCallForwarding[i]);
|
||||||
pw.println(" mDataConnectionState=" + mDataConnectionState[i]);
|
pw.println("mDataActivity=" + mDataActivity[i]);
|
||||||
pw.println(" mDataConnectionPossible=" + mDataConnectionPossible[i]);
|
pw.println("mDataConnectionState=" + mDataConnectionState[i]);
|
||||||
pw.println(" mDataConnectionReason=" + mDataConnectionReason[i]);
|
pw.println("mDataConnectionPossible=" + mDataConnectionPossible[i]);
|
||||||
pw.println(" mDataConnectionApn=" + mDataConnectionApn[i]);
|
pw.println("mDataConnectionReason=" + mDataConnectionReason[i]);
|
||||||
pw.println(" mDataConnectionLinkProperties=" + mDataConnectionLinkProperties[i]);
|
pw.println("mDataConnectionLinkProperties=" + mDataConnectionLinkProperties[i]);
|
||||||
pw.println(" mDataConnectionNetworkCapabilities=" +
|
pw.println("mDataConnectionNetworkCapabilities=" +
|
||||||
mDataConnectionNetworkCapabilities[i]);
|
mDataConnectionNetworkCapabilities[i]);
|
||||||
pw.println(" mCellLocation=" + mCellLocation[i]);
|
pw.println("mCellLocation=" + mCellLocation[i]);
|
||||||
pw.println(" mCellInfo=" + mCellInfo.get(i));
|
pw.println("mCellInfo=" + mCellInfo.get(i));
|
||||||
|
pw.decreaseIndent();
|
||||||
}
|
}
|
||||||
|
pw.println("mConnectedApns=" + Arrays.toString(mConnectedApns));
|
||||||
|
pw.println("mPreciseDataConnectionState=" + mPreciseDataConnectionState);
|
||||||
|
pw.println("mPreciseCallState=" + mPreciseCallState);
|
||||||
|
pw.println("mCarrierNetworkChangeState=" + mCarrierNetworkChangeState);
|
||||||
|
pw.println("mRingingCallState=" + mRingingCallState);
|
||||||
|
pw.println("mForegroundCallState=" + mForegroundCallState);
|
||||||
|
pw.println("mBackgroundCallState=" + mBackgroundCallState);
|
||||||
|
pw.println("mVoLteServiceState=" + mVoLteServiceState);
|
||||||
|
|
||||||
|
pw.decreaseIndent();
|
||||||
|
|
||||||
|
pw.println("local logs:");
|
||||||
|
pw.increaseIndent();
|
||||||
|
mLocalLog.dump(fd, pw, args);
|
||||||
|
pw.decreaseIndent();
|
||||||
pw.println("registrations: count=" + recordCount);
|
pw.println("registrations: count=" + recordCount);
|
||||||
|
pw.increaseIndent();
|
||||||
for (Record r : mRecords) {
|
for (Record r : mRecords) {
|
||||||
pw.println(" " + r);
|
pw.println(r);
|
||||||
}
|
}
|
||||||
|
pw.decreaseIndent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1705,63 +1728,6 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
|||||||
Rlog.d(TAG, s);
|
Rlog.d(TAG, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class LogSSC {
|
|
||||||
private Time mTime;
|
|
||||||
private String mS;
|
|
||||||
private int mSubId;
|
|
||||||
private int mPhoneId;
|
|
||||||
private ServiceState mState;
|
|
||||||
|
|
||||||
public void set(Time t, String s, int subId, int phoneId, ServiceState state) {
|
|
||||||
mTime = t; mS = s; mSubId = subId; mPhoneId = phoneId; mState = state;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return mS + " Time " + mTime.toString() + " mSubId " + mSubId + " mPhoneId "
|
|
||||||
+ mPhoneId + " mState " + mState;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private LogSSC logSSC [] = new LogSSC[10];
|
|
||||||
private int next = 0;
|
|
||||||
|
|
||||||
private void logServiceStateChanged(String s, int subId, int phoneId, ServiceState state) {
|
|
||||||
if (logSSC == null || logSSC.length == 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (logSSC[next] == null) {
|
|
||||||
logSSC[next] = new LogSSC();
|
|
||||||
}
|
|
||||||
Time t = new Time();
|
|
||||||
t.setToNow();
|
|
||||||
logSSC[next].set(t, s, subId, phoneId, state);
|
|
||||||
if (++next >= logSSC.length) {
|
|
||||||
next = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void toStringLogSSC(String prompt) {
|
|
||||||
if (logSSC == null || logSSC.length == 0 || (next == 0 && logSSC[next] == null)) {
|
|
||||||
log(prompt + ": logSSC is empty");
|
|
||||||
} else {
|
|
||||||
// There is at least one element
|
|
||||||
log(prompt + ": logSSC.length=" + logSSC.length + " next=" + next);
|
|
||||||
int i = next;
|
|
||||||
if (logSSC[i] == null) {
|
|
||||||
// logSSC is not full so back to the beginning
|
|
||||||
i = 0;
|
|
||||||
}
|
|
||||||
do {
|
|
||||||
log(logSSC[i].toString());
|
|
||||||
if (++i >= logSSC.length) {
|
|
||||||
i = 0;
|
|
||||||
}
|
|
||||||
} while (i != next);
|
|
||||||
log(prompt + ": ----------------");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean idMatch(int rSubId, int subId, int phoneId) {
|
boolean idMatch(int rSubId, int subId, int phoneId) {
|
||||||
|
|
||||||
if(subId < 0) {
|
if(subId < 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user