Loading AndroidManifest.xml +11 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ <uses-permission android:name="android.permission.BIND_CONNECTION_SERVICE" /> <uses-permission android:name="android.permission.BIND_INCALL_SERVICE" /> <uses-permission android:name="android.permission.MODIFY_PHONE_STATE" /> <uses-permission android:name="android.permission.BROADCAST_CALLLOG_INFO" /> <!-- Protects the ability to register any PhoneAccount with a capability flags of either PhoneAccount#CAPABILITY_CALL_PROVIDER or PhoneAccount#CAPABILITY_SIM_SUBSCRIPTION. --> Loading @@ -44,6 +45,16 @@ android:label="Register CALL_PROVIDER or SIM_SUBSCRIPTION PhoneAccount" android:protectionLevel="signature"/> <permission android:name="android.permission.BROADCAST_CALLLOG_INFO" android:label="Broadcast the call type/duration information" android:protectionLevel="signature|system"/> <permission android:name="android.permission.PROCESS_CALLLOG_INFO" android:label="Register to handle the broadcasted call type/duration information" android:protectionLevel="signature|system"/> <!-- Declare which SDK level this application was built against. This is needed so that IDEs can check for incompatible APIs. --> <uses-sdk android:minSdkVersion="19" /> Loading src/com/android/server/telecom/CallLogManager.java 100644 → 100755 +17 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,8 @@ package com.android.server.telecom; import android.content.Context; import android.content.Intent; import android.Manifest.permission; import android.net.Uri; import android.os.AsyncTask; import android.provider.CallLog.Calls; Loading Loading @@ -83,6 +85,12 @@ final class CallLogManager extends CallsManagerListenerBase { private static final String TAG = CallLogManager.class.getSimpleName(); private final Context mContext; private static final String ACTION_CALLS_TABLE_ADD_ENTRY = "com.android.server.telecom.intent.action.CALLS_ADD_ENTRY"; private static final String PERMISSION_PROCESS_CALLLOG_INFO = "android.permission.PROCESS_CALLLOG_INFO"; private static final String CALL_TYPE = "callType"; private static final String CALL_DURATION = "duration"; public CallLogManager(Context context) { mContext = context; Loading Loading @@ -174,6 +182,8 @@ final class CallLogManager extends CallsManagerListenerBase { // Don't log emergency numbers if the device doesn't allow it. final boolean isOkToLogThisCall = !isEmergencyNumber || okToLogEmergencyNumber; sendAddCallBroadcast(callType, duration); if (isOkToLogThisCall) { Log.d(TAG, "Logging Calllog entry: " + callerInfo + ", " + Log.pii(number) + "," + presentation + ", " + callType Loading Loading @@ -293,4 +303,11 @@ final class CallLogManager extends CallsManagerListenerBase { } } } private void sendAddCallBroadcast(int callType, long duration) { Intent callAddIntent = new Intent(ACTION_CALLS_TABLE_ADD_ENTRY); callAddIntent.putExtra(CALL_TYPE, callType); callAddIntent.putExtra(CALL_DURATION, duration); mContext.sendBroadcast(callAddIntent, PERMISSION_PROCESS_CALLLOG_INFO); } } Loading
AndroidManifest.xml +11 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ <uses-permission android:name="android.permission.BIND_CONNECTION_SERVICE" /> <uses-permission android:name="android.permission.BIND_INCALL_SERVICE" /> <uses-permission android:name="android.permission.MODIFY_PHONE_STATE" /> <uses-permission android:name="android.permission.BROADCAST_CALLLOG_INFO" /> <!-- Protects the ability to register any PhoneAccount with a capability flags of either PhoneAccount#CAPABILITY_CALL_PROVIDER or PhoneAccount#CAPABILITY_SIM_SUBSCRIPTION. --> Loading @@ -44,6 +45,16 @@ android:label="Register CALL_PROVIDER or SIM_SUBSCRIPTION PhoneAccount" android:protectionLevel="signature"/> <permission android:name="android.permission.BROADCAST_CALLLOG_INFO" android:label="Broadcast the call type/duration information" android:protectionLevel="signature|system"/> <permission android:name="android.permission.PROCESS_CALLLOG_INFO" android:label="Register to handle the broadcasted call type/duration information" android:protectionLevel="signature|system"/> <!-- Declare which SDK level this application was built against. This is needed so that IDEs can check for incompatible APIs. --> <uses-sdk android:minSdkVersion="19" /> Loading
src/com/android/server/telecom/CallLogManager.java 100644 → 100755 +17 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,8 @@ package com.android.server.telecom; import android.content.Context; import android.content.Intent; import android.Manifest.permission; import android.net.Uri; import android.os.AsyncTask; import android.provider.CallLog.Calls; Loading Loading @@ -83,6 +85,12 @@ final class CallLogManager extends CallsManagerListenerBase { private static final String TAG = CallLogManager.class.getSimpleName(); private final Context mContext; private static final String ACTION_CALLS_TABLE_ADD_ENTRY = "com.android.server.telecom.intent.action.CALLS_ADD_ENTRY"; private static final String PERMISSION_PROCESS_CALLLOG_INFO = "android.permission.PROCESS_CALLLOG_INFO"; private static final String CALL_TYPE = "callType"; private static final String CALL_DURATION = "duration"; public CallLogManager(Context context) { mContext = context; Loading Loading @@ -174,6 +182,8 @@ final class CallLogManager extends CallsManagerListenerBase { // Don't log emergency numbers if the device doesn't allow it. final boolean isOkToLogThisCall = !isEmergencyNumber || okToLogEmergencyNumber; sendAddCallBroadcast(callType, duration); if (isOkToLogThisCall) { Log.d(TAG, "Logging Calllog entry: " + callerInfo + ", " + Log.pii(number) + "," + presentation + ", " + callType Loading Loading @@ -293,4 +303,11 @@ final class CallLogManager extends CallsManagerListenerBase { } } } private void sendAddCallBroadcast(int callType, long duration) { Intent callAddIntent = new Intent(ACTION_CALLS_TABLE_ADD_ENTRY); callAddIntent.putExtra(CALL_TYPE, callType); callAddIntent.putExtra(CALL_DURATION, duration); mContext.sendBroadcast(callAddIntent, PERMISSION_PROCESS_CALLLOG_INFO); } }