Skip to content

Commit fb794d7

Browse files
authored
Update integration validator with latest permissions and checks for exported (#1875)
* Add extra permissions to IntegrationValidator * Add checks for exported SDL components
1 parent 7ba7e31 commit fb794d7

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

android/sdl_android/src/main/java/com/smartdevicelink/util/IntegrationValidator.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,15 @@ private static ValidationResult checkPermissions(Context context) {
114114
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
115115
permissionList.add(Manifest.permission.FOREGROUND_SERVICE);
116116
}
117+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
118+
permissionList.add(Manifest.permission.BLUETOOTH_CONNECT);
119+
}
120+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
121+
permissionList.add(Manifest.permission.POST_NOTIFICATIONS);
122+
}
123+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
124+
permissionList.add(Manifest.permission.FOREGROUND_SERVICE_CONNECTED_DEVICE);
125+
}
117126
try {
118127
PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getApplicationContext().getPackageName(), PackageManager.GET_PERMISSIONS);
119128
String[] permissionInfos = packageInfo.requestedPermissions;
@@ -161,6 +170,10 @@ public static ValidationResult checkBroadcastReceiver(Context context) {
161170
int j = 0;
162171
for (ResolveInfo sdlReceiver : sdlReceivers) {
163172
if (receiver.name.equals(sdlReceiver.activityInfo.name)) {
173+
if (!receiver.exported) {
174+
retVal.successful = false;
175+
retVal.resultText = "This application has not marked its SdlBroadcastReceiver as exported";
176+
}
164177
return retVal;
165178
}
166179
}
@@ -185,6 +198,11 @@ private static ValidationResult checkRoutServiceMetadata(Context context, Class
185198
retVal.successful = false;
186199
retVal.resultText = "This application has not specified its metadata tags for the SdlRouterService.";
187200
}
201+
202+
if (!info.serviceInfo.exported) {
203+
retVal.successful = false;
204+
retVal.resultText = "This application has not marked its SdlRouterService as exported.";
205+
}
188206
} else {
189207
retVal.successful = false;
190208
retVal.resultText = "This application has not specified its SdlRouterService correctly in the manifest.";

0 commit comments

Comments
 (0)