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

Commit a6f9f2f9 authored by mrulhania's avatar mrulhania Committed by Manjeet Rulhania
Browse files

Get safety center service when sending notification

SafetyCente Service is not available/published
when SensorPrivacyService is initialized.

Fix: 303452988
Test: presubmit
Change-Id: I9e9a6a0fcfd059ed5ba69703659534d8ac4f5848
parent 279533e7
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -174,8 +174,6 @@ public final class SensorPrivacyService extends SystemService {
    private CallStateHelper mCallStateHelper;
    private KeyguardManager mKeyguardManager;

    private SafetyCenterManager mSafetyCenterManager;

    private int mCurrentUser = USER_NULL;

    public SensorPrivacyService(Context context) {
@@ -191,7 +189,6 @@ public final class SensorPrivacyService extends SystemService {
        mTelephonyManager = context.getSystemService(TelephonyManager.class);
        mPackageManagerInternal = getLocalService(PackageManagerInternal.class);
        mSensorPrivacyServiceImpl = new SensorPrivacyServiceImpl();
        mSafetyCenterManager = mContext.getSystemService(SafetyCenterManager.class);
    }

    @Override
@@ -656,7 +653,9 @@ public final class SensorPrivacyService extends SystemService {
            String contentTitle = getUiContext().getString(messageRes);
            Spanned contentText = Html.fromHtml(getUiContext().getString(
                    R.string.sensor_privacy_start_use_notification_content_text, packageLabel), 0);
            String action = mSafetyCenterManager.isSafetyCenterEnabled()
            SafetyCenterManager safetyCenterManager =
                    mContext.getSystemService(SafetyCenterManager.class);
            String action = safetyCenterManager.isSafetyCenterEnabled()
                    ? Settings.ACTION_PRIVACY_CONTROLS : Settings.ACTION_PRIVACY_SETTINGS;

            PendingIntent contentIntent = PendingIntent.getActivity(mContext, sensor,