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

Commit b26f2017 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Disable StrictMode VM Policy check."

parents 583b2e50 224822ec
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ import android.database.DatabaseUtils;
import android.net.Uri;
import android.os.Build;
import android.os.RemoteException;
import android.os.StrictMode;
import android.text.format.DateUtils;
import android.text.format.TimeMigrationUtils;
import android.util.Log;
@@ -2619,8 +2620,14 @@ public final class CalendarContract {
            intent.setData(ContentUris.withAppendedId(CalendarContract.CONTENT_URI, alarmTime));
            intent.putExtra(ALARM_TIME, alarmTime);
            intent.setFlags(Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND);

            // Disable strict mode VM policy violations temporarily for intents that contain a
            // content URI but don't have FLAG_GRANT_READ_URI_PERMISSION.
            StrictMode.VmPolicy oldVmPolicy = StrictMode.allowVmViolations();
            PendingIntent pi = PendingIntent.getBroadcast(context, 0, intent,
                    PendingIntent.FLAG_IMMUTABLE);
            StrictMode.setVmPolicy(oldVmPolicy);

            manager.setExactAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, alarmTime, pi);
        }