[Safer intents] Permission controller

To avoid implicit intents, make intents launch explicitly.

Test: build, manual
Bug: 323061508
Change-Id: Ib95b417fc8682f690890fc55f321b4fece2c0369
This commit is contained in:
Jason Chiu
2024-03-27 12:25:32 +08:00
parent 67bfb4141f
commit cf13dfd4c6
22 changed files with 182 additions and 49 deletions

View File

@@ -19,9 +19,14 @@ package com.android.settings.privacy;
import static android.safetylabel.SafetyLabelConstants.SAFETY_LABEL_CHANGE_NOTIFICATIONS_ENABLED;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.provider.DeviceConfig;
import androidx.annotation.NonNull;
import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
import com.android.settings.core.BasePreferenceController;
/**
@@ -34,6 +39,17 @@ public class AppDataSharingUpdatesPreferenceController extends BasePreferenceCon
super(context, preferenceKey);
}
@Override
public void displayPreference(@NonNull PreferenceScreen screen) {
super.displayPreference(screen);
Preference pref = screen.findPreference(getPreferenceKey());
if (pref != null) {
pref.setIntent(new Intent(Intent.ACTION_REVIEW_APP_DATA_SHARING_UPDATES)
.setPackage(mContext.getPackageManager().getPermissionControllerPackageName()));
}
}
@Override
public int getAvailabilityStatus() {
return isPrivacySafetyLabelChangeNotificationsEnabled(mContext)