Merge changes from topic 'mwd-merge-042415'
* changes:
Fix build - renaming variables.
Merge commit 'a62b505' into merge2
Merge commit '77f10d8' into merge2
Merge commit '569b54e' into merge2
Merge commit 'f7aed89' into merge2
Merge commit '0751e61' into merge2
Merge commit '95ac444' into merge2
diff --git a/src/com/android/server/telecom/Call.java b/src/com/android/server/telecom/Call.java
index 8863215..baa80a8 100644
--- a/src/com/android/server/telecom/Call.java
+++ b/src/com/android/server/telecom/Call.java
@@ -530,6 +530,7 @@
// Log the state transition event
String event = null;
+ Object data = null;
switch (newState) {
case CallState.ACTIVE:
event = Log.Events.SET_ACTIVE;
@@ -542,6 +543,7 @@
break;
case CallState.DISCONNECTED:
event = Log.Events.SET_DISCONNECTED;
+ data = getDisconnectCause();
break;
case CallState.DISCONNECTING:
event = Log.Events.SET_DISCONNECTING;
@@ -557,7 +559,7 @@
break;
}
if (event != null) {
- Log.event(this, event);
+ Log.event(this, event, data);
}
}
}
diff --git a/src/com/android/server/telecom/Log.java b/src/com/android/server/telecom/Log.java
index 10ff6cc..bb5ba90 100644
--- a/src/com/android/server/telecom/Log.java
+++ b/src/com/android/server/telecom/Log.java
@@ -19,6 +19,7 @@
import android.net.Uri;
import android.telecom.PhoneAccount;
import android.telephony.PhoneNumberUtils;
+import android.text.TextUtils;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.IndentingPrintWriter;
@@ -118,12 +119,16 @@
public void dump(IndentingPrintWriter pw) {
Map<String, CallEvent> pendingResponses = new HashMap<>();
- pw.print("Call [");
+ pw.print("Call ");
+ pw.print(mId);
+ pw.print(" [");
pw.print(sDateFormat.format(new Date(mCall.getCreationTimeMillis())));
pw.print("]");
pw.println(mCall.isIncoming() ? "(MT - incoming)" : "(MO - outgoing)");
pw.increaseIndent();
+ pw.println("To address: " + piiHandle(mCall.getHandle()));
+
for (CallEvent event : mEvents) {
// We print out events in chronological order. During that process we look at each
@@ -304,27 +309,35 @@
return String.valueOf(pii);
}
+ StringBuilder sb = new StringBuilder();
if (pii instanceof Uri) {
Uri uri = (Uri) pii;
+ String scheme = uri.getScheme();
- // All Uri's which are not "tel" go through normal pii() method.
- if (!PhoneAccount.SCHEME_TEL.equals(uri.getScheme())) {
- return pii(pii);
+ if (!TextUtils.isEmpty(scheme)) {
+ sb.append(scheme).append(":");
+ }
+
+ String textToObfuscate = uri.getSchemeSpecificPart();
+ if (PhoneAccount.SCHEME_TEL.equals(scheme)) {
+ for (int i = 0; i < textToObfuscate.length(); i++) {
+ char c = textToObfuscate.charAt(i);
+ sb.append(PhoneNumberUtils.isDialable(c) ? "*" : c);
+ }
+ } else if (PhoneAccount.SCHEME_SIP.equals(scheme)) {
+ for (int i = 0; i < textToObfuscate.length(); i++) {
+ char c = textToObfuscate.charAt(i);
+ if (c != '@' && c != '.') {
+ c = '*';
+ }
+ sb.append(c);
+ }
} else {
- pii = uri.getSchemeSpecificPart();
+ sb.append(pii(pii));
}
}
- String originalString = String.valueOf(pii);
- StringBuilder stringBuilder = new StringBuilder(originalString.length());
- for (char c : originalString.toCharArray()) {
- if (PhoneNumberUtils.isDialable(c)) {
- stringBuilder.append('*');
- } else {
- stringBuilder.append(c);
- }
- }
- return stringBuilder.toString();
+ return sb.toString();
}
/**
diff --git a/src/com/android/server/telecom/TelecomServiceImpl.java b/src/com/android/server/telecom/TelecomServiceImpl.java
index bcb23be..f267efc 100644
--- a/src/com/android/server/telecom/TelecomServiceImpl.java
+++ b/src/com/android/server/telecom/TelecomServiceImpl.java
@@ -30,6 +30,7 @@
import android.os.IBinder;
import android.os.UserHandle;
import android.os.UserManager;
+import android.telecom.DefaultDialerManager;
import android.telecom.PhoneAccount;
import android.telecom.PhoneAccountHandle;
import android.telecom.TelecomManager;
@@ -444,6 +445,8 @@
/**
* @see android.telecom.TelecomManager#getDefaultPhoneApp
+ * @deprecated - Use {@link android.telecom.TelecomManager#getDefaultDialerPackage()}
+ * instead.
*/
@Override
public ComponentName getDefaultPhoneApp() {
@@ -455,6 +458,30 @@
}
/**
+ * @return the package name of the current user-selected default dialer. If no default
+ * has been selected, the package name of the system dialer is returned. If
+ * neither exists, then {@code null} is returned.
+ * @see android.telecom.TelecomManager#getDefaultDialerPackage
+ */
+ @Override
+ public String getDefaultDialerPackage() {
+ final ComponentName defaultDialer =
+ DefaultDialerManager.getDefaultDialerApplication(mContext);
+ if (defaultDialer != null) {
+ return defaultDialer.getPackageName();
+ }
+ return null;
+ }
+
+ /**
+ * @see android.telecom.TelecomManager#getSystemDialerPackage
+ */
+ @Override
+ public String getSystemDialerPackage() {
+ return mContext.getResources().getString(R.string.ui_default_package);
+ }
+
+ /**
* @see android.telecom.TelecomManager#isInCall
*/
@Override
@@ -717,9 +744,11 @@
+ " is not allowed to place phone calls");
}
synchronized (mLock) {
+ long token = Binder.clearCallingIdentity();
final Intent intent = new Intent(Intent.ACTION_CALL, handle);
intent.putExtras(extras);
new UserCallIntentProcessor(mContext).processIntent(intent, callingPackage);
+ Binder.restoreCallingIdentity(token);
}
}