DO NOT MERGE Add more intents for notifications
Bug: 114008723
Test: manual / existing robolectric
Change-Id: I83ddc30e865199c6b8f6c1f82e600816d90accca
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 8b599f5..b797d9e 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -206,6 +206,17 @@
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
+ <intent-filter android:priority="100">
+ <action android:name="android.settings.CHANNEL_NOTIFICATION_SETTINGS" />
+ <action android:name="android.settings.APP_NOTIFICATION_SETTINGS" />
+ <category android:name="android.intent.category.DEFAULT" />
+ </intent-filter>
+
+ <intent-filter android:priority="100">
+ <action android:name="android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS" />
+ <category android:name="android.intent.category.DEFAULT" />
+ </intent-filter>
+
<meta-data android:name="distractionOptimized" android:value="true"/>
</activity>
diff --git a/src/com/android/car/settings/common/FragmentResolver.java b/src/com/android/car/settings/common/FragmentResolver.java
index 13a31af..c756034 100644
--- a/src/com/android/car/settings/common/FragmentResolver.java
+++ b/src/com/android/car/settings/common/FragmentResolver.java
@@ -19,6 +19,7 @@
import android.content.Intent;
import android.net.Uri;
import android.provider.Settings;
+import android.text.TextUtils;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
@@ -31,6 +32,7 @@
import com.android.car.settings.applications.DefaultApplicationsSettingsFragment;
import com.android.car.settings.applications.assist.ManageAssistFragment;
import com.android.car.settings.applications.defaultapps.DefaultAutofillPickerFragment;
+import com.android.car.settings.applications.specialaccess.NotificationAccessFragment;
import com.android.car.settings.bluetooth.BluetoothSettingsFragment;
import com.android.car.settings.datausage.DataUsageFragment;
import com.android.car.settings.datetime.DatetimeSettingsFragment;
@@ -138,12 +140,22 @@
return new ApplicationsSettingsFragment();
case Settings.ACTION_APPLICATION_DETAILS_SETTINGS:
- Uri uri = intent.getData();
- if (uri == null) {
- LOG.w("No uri provided for application detailed intent");
- return null;
+ case Settings.ACTION_CHANNEL_NOTIFICATION_SETTINGS:
+ case Settings.ACTION_APP_NOTIFICATION_SETTINGS:
+ String pkg = intent.getStringExtra(Settings.EXTRA_APP_PACKAGE);
+ if (TextUtils.isEmpty(pkg)) {
+ LOG.w("No package provided for application detailed intent");
+ Uri uri = intent.getData();
+ if (uri == null) {
+ LOG.w("No uri provided for application detailed intent");
+ return null;
+ }
+ pkg = uri.getSchemeSpecificPart();
}
- return ApplicationDetailsFragment.getInstance(uri.getSchemeSpecificPart());
+ return ApplicationDetailsFragment.getInstance(pkg);
+
+ case Settings.ACTION_NOTIFICATION_LISTENER_SETTINGS:
+ return new NotificationAccessFragment();
case Settings.ACTION_SYNC_SETTINGS:
return new AccountSettingsFragment();