Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 69492888 authored by Julia Reynolds's avatar Julia Reynolds
Browse files

Let extra apps launch channel settings.

Test: manual
Change-Id: I689c0b35224dffc306ecbfa6f25ad3f072cd4dba
parent 88c0364a
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -2700,6 +2700,22 @@
                android:value="com.android.settings.notification.AppNotificationSettings" />
        </activity>

        <!-- Show channel-level notification settings (channel passed in as extras) -->
        <activity android:name="Settings$ChannelNotificationSettingsActivity"
                  android:label="@string/app_notifications_title"
                  android:exported="true">
            <intent-filter android:priority="1">
                <action android:name="android.settings.CHANNEL_NOTIFICATION_SETTINGS" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
            <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
                       android:value="com.android.settings.notification.ChannelNotificationSettings" />
        </activity>

        <!-- Show Manual (from settings item) -->
        <activity android:name="ManualDisplayActivity"
                  android:label="@string/manual"
+1 −0
Original line number Diff line number Diff line
@@ -124,6 +124,7 @@ public class Settings extends SettingsActivity {
    public static class ConfigureNotificationSettingsActivity extends SettingsActivity { /* empty */ }
    public static class NotificationAppListActivity extends SettingsActivity { /* empty */ }
    public static class AppNotificationSettingsActivity extends SettingsActivity { /* empty */ }
    public static class ChannelNotificationSettingsActivity extends SettingsActivity { /* empty */ }
    public static class OtherSoundSettingsActivity extends SettingsActivity { /* empty */ }
    public static class ManageDomainUrlsActivity extends SettingsActivity { /* empty */ }
    public static class AutomaticStorageManagerSettingsActivity extends SettingsActivity { /* empty */ }
+2 −0
Original line number Diff line number Diff line
@@ -101,6 +101,7 @@ import com.android.settings.network.NetworkDashboardFragment;
import com.android.settings.nfc.AndroidBeam;
import com.android.settings.nfc.PaymentSettings;
import com.android.settings.notification.AppNotificationSettings;
import com.android.settings.notification.ChannelNotificationSettings;
import com.android.settings.notification.ConfigureNotificationSettings;
import com.android.settings.notification.NotificationAccessSettings;
import com.android.settings.notification.NotificationStation;
@@ -209,6 +210,7 @@ public class SettingsGateway {
            InstalledAppDetails.class.getName(),
            BatterySaverSettings.class.getName(),
            AppNotificationSettings.class.getName(),
            ChannelNotificationSettings.class.getName(),
            OtherSoundSettings.class.getName(),
            ApnSettings.class.getName(),
            ApnEditor.class.getName(),
+10 −3
Original line number Diff line number Diff line
@@ -25,8 +25,10 @@ import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
import android.content.pm.ResolveInfo;
import android.os.Bundle;
import android.provider.Settings;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceCategory;
import android.text.TextUtils;
import android.util.ArrayMap;
import android.util.Log;

@@ -84,6 +86,11 @@ public class AppNotificationSettings extends NotificationSettingsBase {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (mUid < 0 || TextUtils.isEmpty(mPkg) || mPkgInfo == null) {
            Log.w(TAG, "Missing package or uid or packageinfo");
            toastAndFinish();
            return;
        }
        final Activity activity = getActivity();
        mDashboardFeatureProvider =
                FeatureFactory.getFactory(activity).getDashboardFeatureProvider(activity);
@@ -124,7 +131,7 @@ public class AppNotificationSettings extends NotificationSettingsBase {
                        channelArgs.putInt(AppInfoBase.ARG_PACKAGE_UID, mUid);
                        channelArgs.putBoolean(AppHeader.EXTRA_HIDE_INFO_BUTTON, true);
                        channelArgs.putString(AppInfoBase.ARG_PACKAGE_NAME, mPkg);
                        channelArgs.putString(ARG_CHANNEL, channel.getId());
                        channelArgs.putString(Settings.EXTRA_CHANNEL_ID, channel.getId());
                        Intent channelIntent = Utils.onBuildStartFragmentIntent(getActivity(),
                                ChannelNotificationSettings.class.getName(),
                                channelArgs, null, 0, null, false);
@@ -154,8 +161,8 @@ public class AppNotificationSettings extends NotificationSettingsBase {
    @Override
    public void onResume() {
        super.onResume();
        if ((mUid != -1 && getPackageManager().getPackagesForUid(mUid) == null)) {
            // App isn't around anymore, must have been removed.
        if (mUid < 0 || TextUtils.isEmpty(mPkg) || mPkgInfo == null) {
            Log.w(TAG, "Missing package or uid or packageinfo");
            finish();
            return;
        }
+10 −4
Original line number Diff line number Diff line
@@ -26,7 +26,6 @@ import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.admin.DevicePolicyManager;
import android.content.Context;
import android.content.Intent;
import android.content.pm.UserInfo;
import android.net.Uri;
@@ -35,6 +34,8 @@ import android.os.UserHandle;
import android.provider.Settings;
import android.service.notification.NotificationListenerService.Ranking;
import android.support.v7.preference.Preference;
import android.text.TextUtils;
import android.util.Log;

import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.internal.widget.LockPatternUtils;
@@ -87,6 +88,11 @@ public class ChannelNotificationSettings extends NotificationSettingsBase {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (mUid < 0 || TextUtils.isEmpty(mPkg) || mPkgInfo == null || mChannel == null) {
            Log.w(TAG, "Missing package or uid or packageinfo or channel");
            toastAndFinish();
            return;
        }
        final Activity activity = getActivity();
        mDashboardFeatureProvider =
                FeatureFactory.getFactory(activity).getDashboardFeatureProvider(activity);
@@ -103,7 +109,7 @@ public class ChannelNotificationSettings extends NotificationSettingsBase {
        mVibrate = (RestrictedSwitchPreference) findPreference(KEY_VIBRATE);
        mRingtone = (DefaultNotificationTonePreference) findPreference(KEY_RINGTONE);

        if (mPkgInfo != null) {
        if (mPkgInfo != null && mChannel != null) {
            setupPriorityPref(mChannel.canBypassDnd());
            setupVisOverridePref(mChannel.getLockscreenVisibility());
            setupLights();
@@ -131,8 +137,8 @@ public class ChannelNotificationSettings extends NotificationSettingsBase {
    @Override
    public void onResume() {
        super.onResume();
        if ((mUid != -1 && getPackageManager().getPackagesForUid(mUid) == null)) {
            // App isn't around anymore, must have been removed.
        if (mUid < 0 || TextUtils.isEmpty(mPkg) || mPkgInfo == null || mChannel == null) {
            Log.w(TAG, "Missing package or uid or packageinfo or channel");
            finish();
            return;
        }
Loading