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

Commit 35e2429c authored by Gitsaibot's avatar Gitsaibot Committed by Jochen Sprickerhof
Browse files

Resolve lint missing permission warning.

parent 5f005c17
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.calendar;

import android.Manifest;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
@@ -26,6 +27,7 @@ import android.content.ContentResolver;
import android.content.ContentUris;
import android.content.Context;
import android.content.DialogInterface;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.database.Cursor;
@@ -37,10 +39,12 @@ import android.graphics.Rect;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.os.Handler;
import android.provider.CalendarContract.Attendees;
import android.provider.CalendarContract.Calendars;
import android.provider.CalendarContract.Events;
import android.support.v4.content.ContextCompat;
import android.text.Layout.Alignment;
import android.text.SpannableStringBuilder;
import android.text.StaticLayout;
@@ -737,6 +741,13 @@ public class DayView extends View implements View.OnCreateContextMenuListener,

                Uri uri = Calendars.CONTENT_URI;
                String where = String.format(CALENDARS_WHERE, calId);
                if (Build.VERSION.SDK_INT >= 23 && ContextCompat.checkSelfPermission(context,
                        Manifest.permission.READ_CALENDAR)
                        != PackageManager.PERMISSION_GRANTED) {
                    //If permission is not granted then just return.
                    Log.d(TAG, "Manifest.permission.READ_CALENDAR is not granted");
                    return 0;
                }
                cursor = cr.query(uri, CALENDARS_PROJECTION, where, null, null);

                String calendarOwnerAccount = null;
+12 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@

package com.android.calendar;

import android.Manifest;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.AsyncQueryHandler;
@@ -24,13 +25,16 @@ import android.content.ContentResolver;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.provider.CalendarContract;
import android.provider.CalendarContract.Attendees;
import android.provider.CalendarContract.Calendars;
import android.provider.CalendarContract.Events;
import android.support.v4.content.ContextCompat;
import android.text.TextUtils;
import android.util.Base64;
import android.util.Log;
@@ -153,6 +157,14 @@ public class GoogleCalendarUriIntentFilter extends Activity {
                            + Calendars.OWNER_ACCOUNT + " LIKE \"" + ownerAccount + "\"";

                    if (debug) Log.d(TAG, "selection: " + selection);

                    if (Build.VERSION.SDK_INT >= 23 && ContextCompat.checkSelfPermission(this,
                            Manifest.permission.READ_CALENDAR)
                            != PackageManager.PERMISSION_GRANTED) {
                        //If permission is not granted then just return.
                        Log.d(TAG, "Manifest.permission.READ_CALENDAR is not granted");
                        return;
                    }
                    Cursor eventCursor = getContentResolver().query(Events.CONTENT_URI,
                            EVENT_PROJECTION, selection, null,
                            Calendars.CALENDAR_ACCESS_LEVEL + " desc");
+7 −0
Original line number Diff line number Diff line
@@ -245,6 +245,13 @@ public class AlarmScheduler {
            // Query the reminders table for the events found.
            Cursor cursor = null;
            try {
                if (Build.VERSION.SDK_INT >= 23 && ContextCompat.checkSelfPermission(context,
                        Manifest.permission.READ_CALENDAR)
                        != PackageManager.PERMISSION_GRANTED) {
                    //If permission is not granted then just return.
                    Log.d(TAG, "Manifest.permission.READ_CALENDAR is not granted");
                    return;
                }
                cursor = contentResolver.query(Reminders.CONTENT_URI, REMINDERS_PROJECTION,
                        REMINDERS_WHERE + eventIdsForQuery, null, null);

+10 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.calendar.alerts;

import android.Manifest;
import android.app.Notification;
import android.app.PendingIntent;
import android.app.Service;
@@ -29,12 +30,14 @@ import android.content.pm.ResolveInfo;
import android.content.res.Resources;
import android.database.Cursor;
import android.net.Uri;
import android.os.Build;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.PowerManager;
import android.provider.CalendarContract.Attendees;
import android.provider.CalendarContract.Calendars;
import android.provider.CalendarContract.Events;
import android.support.v4.content.ContextCompat;
import android.telephony.TelephonyManager;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
@@ -553,6 +556,13 @@ public class AlertReceiver extends BroadcastReceiver {
    }

    private static Cursor getAttendeesCursor(Context context, long eventId) {
        if (Build.VERSION.SDK_INT >= 23 && ContextCompat.checkSelfPermission(context,
                Manifest.permission.READ_CALENDAR)
                != PackageManager.PERMISSION_GRANTED) {
            //If permission is not granted then just return.
            Log.d(TAG, "Manifest.permission.READ_CALENDAR is not granted");
            return null;
        }
        return context.getContentResolver().query(Attendees.CONTENT_URI,
                ATTENDEES_PROJECTION, ATTENDEES_WHERE, new String[] { Long.toString(eventId) },
                ATTENDEES_SORT_ORDER);
+7 −0
Original line number Diff line number Diff line
@@ -133,6 +133,13 @@ public class AlertService extends Service {
        final long currentTime = System.currentTimeMillis();
        ContentValues vals = new ContentValues();
        vals.put(CalendarAlerts.STATE, CalendarAlerts.STATE_DISMISSED);
        if (Build.VERSION.SDK_INT >= 23 && ContextCompat.checkSelfPermission(context,
                Manifest.permission.WRITE_CALENDAR)
                != PackageManager.PERMISSION_GRANTED) {
            //If permission is not granted then just return.
            Log.d(TAG, "Manifest.permission.WRITE_CALENDAR is not granted");
            return;
        }
        cr.update(CalendarAlerts.CONTENT_URI, vals, DISMISS_OLD_SELECTION, new String[] {
                Long.toString(currentTime), Integer.toString(CalendarAlerts.STATE_SCHEDULED)
        });
Loading