Merge "Fix flash notification preview not working for second user issue" into main

This commit is contained in:
Angela Wang
2023-08-19 08:38:38 +00:00
committed by Android (Google) Code Review
3 changed files with 9 additions and 6 deletions

View File

@@ -28,6 +28,7 @@ import android.database.ContentObserver;
import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
import android.os.UserHandle;
import android.provider.Settings;
import androidx.annotation.NonNull;
@@ -81,7 +82,7 @@ public class FlashNotificationsPreviewPreferenceController extends
if (getPreferenceKey().equals(preference.getKey())) {
Intent intent = new Intent(ACTION_FLASH_NOTIFICATION_START_PREVIEW);
intent.putExtra(EXTRA_FLASH_NOTIFICATION_PREVIEW_TYPE, TYPE_SHORT_PREVIEW);
mContext.sendBroadcast(intent);
mContext.sendBroadcastAsUser(intent, UserHandle.SYSTEM);
return true;
}

View File

@@ -27,6 +27,7 @@ import android.app.Dialog;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.os.UserHandle;
import android.view.View;
import androidx.annotation.ColorInt;
@@ -41,6 +42,7 @@ import java.util.Timer;
import java.util.TimerTask;
import java.util.function.Consumer;
/**
* DialogFragment for Screen flash notification color picker.
*/
@@ -166,14 +168,14 @@ public class ScreenFlashNotificationColorDialogFragment extends DialogFragment i
Intent intent = new Intent(ACTION_FLASH_NOTIFICATION_START_PREVIEW);
intent.putExtra(EXTRA_FLASH_NOTIFICATION_PREVIEW_TYPE, TYPE_LONG_PREVIEW);
intent.putExtra(EXTRA_FLASH_NOTIFICATION_PREVIEW_COLOR, mCurrentColor);
getContext().sendBroadcast(intent);
getContext().sendBroadcastAsUser(intent, UserHandle.SYSTEM);
}
private void stopPreviewLocked() {
if (getContext() == null) return;
Intent stopIntent = new Intent(ACTION_FLASH_NOTIFICATION_STOP_PREVIEW);
getContext().sendBroadcast(stopIntent);
getContext().sendBroadcastAsUser(stopIntent, UserHandle.SYSTEM);
mIsPreview = false;
}