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

Commit 9539704b authored by Kavita Patil's avatar Kavita Patil Committed by Michael Bestas
Browse files

Fixed crash of WeekView, Agenda, Settings & MonthView screens when calendar...

Fixed crash of WeekView, Agenda, Settings & MonthView screens when calendar permission is not given (#965)

Fixed crash of WeekView, Agenda, Settings & MonthView screens when calendar permission is not given

Change-Id: I1225baefe56d889927fd5a073feff35b79025d5f
parent 043c90b8
Loading
Loading
Loading
Loading
+3 −9
Original line number Diff line number Diff line
@@ -73,7 +73,6 @@ import android.widget.RelativeLayout;
import android.widget.RelativeLayout.LayoutParams;
import android.widget.TextView;
import android.widget.Toast;

import com.android.calendar.CalendarController.EventHandler;
import com.android.calendar.CalendarController.EventInfo;
import com.android.calendar.CalendarController.EventType;
@@ -82,7 +81,6 @@ import com.android.calendar.agenda.AgendaFragment;
import com.android.calendar.alerts.AlertService;
import com.android.calendar.month.MonthByWeekFragment;
import com.android.calendar.selectcalendars.SelectVisibleCalendarsFragment;

import java.io.File;
import java.util.Calendar;
import java.util.List;
@@ -563,9 +561,7 @@ public class AllInOneActivity extends AbstractCalendarActivity implements EventH
        mController.registerFirstEventHandler(HANDLER_KEY, this);
        mOnSaveInstanceStateCalled = false;

        if (Build.VERSION.SDK_INT >= 23 && ContextCompat.checkSelfPermission(this,
                Manifest.permission.READ_CALENDAR)
                != PackageManager.PERMISSION_GRANTED) {
        if (!Utils.isCalendarPermissionGranted(this, true)) {
            //If permission is not granted then just return.
            Log.d(TAG, "Manifest.permission.READ_CALENDAR is not granted");
            return;
@@ -618,9 +614,7 @@ public class AllInOneActivity extends AbstractCalendarActivity implements EventH
        mPaused = true;
        mHomeTime.removeCallbacks(mHomeTimeUpdater);

        if (Build.VERSION.SDK_INT >= 23 && ContextCompat.checkSelfPermission(this,
                Manifest.permission.READ_CALENDAR)
                != PackageManager.PERMISSION_GRANTED) {
        if (!Utils.isCalendarPermissionGranted(this, false)) {
            //If permission is not granted then just return.
            Log.d(TAG, "Manifest.permission.WRITE_CALENDAR is not granted");
            return;
+1 −3
Original line number Diff line number Diff line
@@ -264,9 +264,7 @@ public class CalendarUtils {
                        if (mHandler == null) {
                            mHandler = new AsyncTZHandler(context.getContentResolver());
                        }
                        if (Build.VERSION.SDK_INT < 23 || ContextCompat.checkSelfPermission(context,
                                Manifest.permission.READ_CALENDAR) ==
                                PackageManager.PERMISSION_GRANTED) {
                        if (Utils.isCalendarPermissionGranted(context, false)) {
                            mHandler.startQuery(0, context, CalendarCache.URI,
                                    CALENDAR_CACHE_POJECTION, null, null, null);
                        }
+1 −2
Original line number Diff line number Diff line
@@ -4554,8 +4554,7 @@ 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 (!Utils.isCalendarPermissionGranted(context, false)) {
            // If permission is not granted then just return.
            Log.d(TAG, "Manifest.permission.READ_CALENDAR is not granted");
            return 0;
+1 −3
Original line number Diff line number Diff line
@@ -183,9 +183,7 @@ public class Event implements Cloneable {
            Debug.startMethodTracing("loadEvents");
        }

        if (Build.VERSION.SDK_INT >= 23 && ContextCompat.checkSelfPermission(context,
                Manifest.permission.READ_CALENDAR)
                != PackageManager.PERMISSION_GRANTED) {
        if (!Utils.isCalendarPermissionGranted(context, false)) {
            //If permission is not granted then just return.
            return;
        }
+1 −3
Original line number Diff line number Diff line
@@ -158,9 +158,7 @@ public class GoogleCalendarUriIntentFilter extends Activity {

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

                    if (Build.VERSION.SDK_INT >= 23 && ContextCompat.checkSelfPermission(this,
                            Manifest.permission.READ_CALENDAR)
                            != PackageManager.PERMISSION_GRANTED) {
                    if (!Utils.isCalendarPermissionGranted(this, false)) {
                        //If permission is not granted then just return.
                        Log.d(TAG, "Manifest.permission.READ_CALENDAR is not granted");
                        return;
Loading