Add TelephonyCommonStatsLog

Add TelephonyCommonStatsLog to framework-telephony-common-sources to
replace StatsLog call in TelephonyPermissions. This allows
TelephonyPermissions to be part of frameworks.jar after being jarjar'ed and also be included
statically in Mainline modules.

Bug: 145952197
Test: m frameworks-minus-apex
Test: fastboot flashall
Test: atest TelephonyCommonTests
Change-Id: I0b9e946e2b4a64a05acaf3132dffd8fc22f7d51d
This commit is contained in:
Muhammad Qureshi
2020-01-24 16:07:49 -08:00
parent e4a81f01a6
commit ed8bca0bf8
3 changed files with 13 additions and 5 deletions

View File

@@ -191,12 +191,20 @@ filegroup {
path: "telephony/java",
}
genrule {
name: "statslog-telephony-common-java-gen",
tools: ["stats-log-api-gen"],
cmd: "$(location stats-log-api-gen) --java $(out) --module telephony_common"
+ " --javaPackage com.android.internal.telephony --javaClass TelephonyCommonStatsLog",
out: ["com/android/internal/telephony/TelephonyCommonStatsLog.java"],
}
filegroup {
name: "framework-telephony-common-sources",
srcs: [
"telephony/common/**/*.java",
":statslog-telephony-common-java-gen",
],
path: "telephony/common",
}
filegroup {

View File

@@ -255,7 +255,8 @@ message Atom {
PermissionGrantRequestResultReported permission_grant_request_result_reported =
170 [(module) = "permissioncontroller"];
BluetoothSocketConnectionStateChanged bluetooth_socket_connection_state_changed = 171;
DeviceIdentifierAccessDenied device_identifier_access_denied = 172;
DeviceIdentifierAccessDenied device_identifier_access_denied =
172 [(module) = "telephony_common"];
BubbleDeveloperErrorReported bubble_developer_error_reported = 173;
AssistGestureStageReported assist_gesture_stage_reported = 174;
AssistGestureFeedbackReported assist_gesture_feedback_reported = 175;

View File

@@ -31,7 +31,6 @@ import android.os.UserHandle;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.util.Log;
import android.util.StatsLog;
import com.android.internal.annotations.VisibleForTesting;
@@ -393,8 +392,8 @@ public final class TelephonyPermissions {
invokedMethods = sReportedDeviceIDPackages.get(callingPackage);
}
invokedMethods.add(message);
StatsLog.write(StatsLog.DEVICE_IDENTIFIER_ACCESS_DENIED, callingPackage, message,
isPreinstalled, false);
TelephonyCommonStatsLog.write(TelephonyCommonStatsLog.DEVICE_IDENTIFIER_ACCESS_DENIED,
callingPackage, message, isPreinstalled, false);
}
Log.w(LOG_TAG, "reportAccessDeniedToReadIdentifiers:" + callingPackage + ":" + message
+ ":isPreinstalled=" + isPreinstalled);