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

Commit 58e2ba85 authored by DvTonder's avatar DvTonder
Browse files

Framework: Forward port Fixes

1)  NPE in Power penu

This fixes the NPE when the Reboot item is disabled and the Profiles
switcher is not

2) NPE in notification manager if profiles disabled

No active profile group is returned and a NPE is triggered when a
notification override is being set

Change-Id: I5fa003ce08daf5ef86ddeca5d432dcea2e34a718
parent 3493cecd
Loading
Loading
Loading
Loading
+11 −4
Original line number Diff line number Diff line
@@ -873,11 +873,18 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
            ImageView icon = (ImageView) v.findViewById(R.id.icon);
            TextView messageView = (TextView) v.findViewById(R.id.message);
            TextView statusView = (TextView) v.findViewById(R.id.status);
            if (statusView != null) {
                statusView.setVisibility(View.VISIBLE);
                statusView.setText(mProfileManager.getActiveProfile().getName());
            }

            if (icon != null) {
                icon.setImageDrawable(context.getResources().getDrawable(R.drawable.ic_lock_profile));
            }

            if (messageView != null) {
                messageView.setText(R.string.global_action_choose_profile);
            }

            return v;
        }
+3 −4
Original line number Diff line number Diff line
@@ -27,10 +27,7 @@ import android.app.IActivityManager;
import android.app.INotificationManager;
import android.app.ITransientNotification;
import android.app.Notification;
import android.app.NotificationGroup;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Profile;
import android.app.ProfileGroup;
import android.app.ProfileManager;
import android.app.StatusBarManager;
@@ -1201,7 +1198,9 @@ public class NotificationManagerService extends INotificationManager.Stub
                        (ProfileManager) mContext.getSystemService(Context.PROFILE_SERVICE);

                ProfileGroup group = profileManager.getActiveProfileGroup(pkg);
                if (group != null) {
                    notification = group.processNotification(notification);
                }
            } catch(Throwable th) {
                Log.e(TAG, "An error occurred profiling the notification.", th);
            }