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

Unverified Commit c5fdbdd4 authored by Marten Gajda's avatar Marten Gajda Committed by GitHub
Browse files

Update SDK target level to 26. Implements #703 (#719)

This also updates the support library version to 26.1.0.
Due to changes in Android 8 we had to limit some background service and broadcast functionality. There are no limitations to the user experience though, but some planned features may require a different solution now (mostly because implicit broadcasts no longer work).
parent 7396a2d3
Loading
Loading
Loading
Loading
+6 −1
Original line number Original line Diff line number Diff line
@@ -9,15 +9,17 @@ android:
    - tools
    - tools
    - platform-tools
    - platform-tools
    - tools
    - tools
    - build-tools-26.0.2
    - build-tools-27.0.1
    - build-tools-27.0.1
    - android-24
    - android-24
    - android-25
    - android-26
    - android-26
    - extra
    - extra-android-m2repository
    - extra-android-m2repository
    - sys-img-armeabi-v7a-android-24
    - sys-img-armeabi-v7a-android-24


# Emulator Management: Create, Start and Wait
# Emulator Management: Create, Start and Wait
before_script:
before_script:
  - android list targets
  - echo no | android create avd --force -n test --target android-24 --abi armeabi-v7a
  - echo no | android create avd --force -n test --target android-24 --abi armeabi-v7a
  - QEMU_AUDIO_DRV=none emulator -avd test -no-window &
  - QEMU_AUDIO_DRV=none emulator -avd test -no-window &
  - android-wait-for-emulator
  - android-wait-for-emulator
@@ -26,3 +28,6 @@ before_script:
script:
script:
  - android list target
  - android list target
  - ./gradlew check connectedAndroidTest
  - ./gradlew check connectedAndroidTest

after_script:
  - cat /home/travis/build/dmfs/opentasks/opentasks/build/reports/lint-results.xml
 No newline at end of file
+1 −1
Original line number Original line Diff line number Diff line
def support_lib_version = '25.4.0'
def support_lib_version = '26.1.0'
def jems_version = '1.15'
def jems_version = '1.15'
def contentpal_version = '9b087b2' // 9b087b2 -> 2017-12-12
def contentpal_version = '9b087b2' // 9b087b2 -> 2017-12-12
def support_test_runner_version = '0.5'
def support_test_runner_version = '0.5'
+2 −2
Original line number Original line Diff line number Diff line
COMPILE_SDK_VERSION=25
COMPILE_SDK_VERSION=26
BUILD_TOOLS_VERSION=27.0.1
BUILD_TOOLS_VERSION=27.0.1
MIN_SDK_VERSION=15
MIN_SDK_VERSION=15
TARGET_SDK_VERSION=25
TARGET_SDK_VERSION=26
+6 −0
Original line number Original line Diff line number Diff line
@@ -26,6 +26,7 @@ import android.content.UriMatcher;
import android.database.Cursor;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase;
import android.net.Uri;
import android.net.Uri;
import android.os.Build;
import android.os.Handler;
import android.os.Handler;
import android.util.Log;
import android.util.Log;


@@ -183,6 +184,11 @@ public enum ContentOperation
                intent.putExtra(TaskContract.EXTRA_TASK_TIMEZONE, datetime.getTimeZone().getID());
                intent.putExtra(TaskContract.EXTRA_TASK_TIMEZONE, datetime.getTimeZone().getID());
            }
            }
            intent.putExtra(TaskContract.EXTRA_TASK_TITLE, title);
            intent.putExtra(TaskContract.EXTRA_TASK_TITLE, title);
            if (Build.VERSION.SDK_INT >= 26)
            {
                // for now only notify our own package
                intent.setPackage(context.getPackageName());
            }
            context.sendBroadcast(intent);
            context.sendBroadcast(intent);
        }
        }
    }),
    }),
+10 −8
Original line number Original line Diff line number Diff line
@@ -32,6 +32,7 @@ import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteQueryBuilder;
import android.database.sqlite.SQLiteQueryBuilder;
import android.net.Uri;
import android.net.Uri;
import android.os.Build;
import android.os.Handler;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.HandlerThread;
import android.text.TextUtils;
import android.text.TextUtils;
@@ -1294,6 +1295,12 @@ public final class TaskProvider extends SQLiteContentProvider implements OnAccou
        }
        }
        // add the change log to the broadcast
        // add the change log to the broadcast
        providerChangedIntent.putExtras(mOperationsLog.toBundle(true));
        providerChangedIntent.putExtras(mOperationsLog.toBundle(true));
        if (Build.VERSION.SDK_INT >= 26)
        {
            // for now we only notify our own package
            // we'll have to figure out how to do this correctly on Android 8+, e.g. how is it done by CalendarProvider and ContactsProvider
            providerChangedIntent.setPackage(getContext().getPackageName());
        }
        getContext().sendBroadcast(providerChangedIntent);
        getContext().sendBroadcast(providerChangedIntent);
    }
    }


@@ -1313,6 +1320,8 @@ public final class TaskProvider extends SQLiteContentProvider implements OnAccou
        // notify listeners that the database has been created
        // notify listeners that the database has been created
        Intent dbInitializedIntent = new Intent(TaskContract.ACTION_DATABASE_INITIALIZED);
        Intent dbInitializedIntent = new Intent(TaskContract.ACTION_DATABASE_INITIALIZED);
        dbInitializedIntent.setDataAndType(TaskContract.getContentUri(mAuthority), TaskContract.MIMETYPE_AUTHORITY);
        dbInitializedIntent.setDataAndType(TaskContract.getContentUri(mAuthority), TaskContract.MIMETYPE_AUTHORITY);
        // Android SDK 26 doesn't allow us to send implicit broadcasts, this particular brodcast is only for internal use, so just make it explicit by setting our package name
        dbInitializedIntent.setPackage(getContext().getPackageName());
        getContext().sendBroadcast(dbInitializedIntent);
        getContext().sendBroadcast(dbInitializedIntent);
    }
    }


@@ -1322,14 +1331,7 @@ public final class TaskProvider extends SQLiteContentProvider implements OnAccou
    {
    {
        if (oldVersion < 15)
        if (oldVersion < 15)
        {
        {
            mAsyncHandler.post(new Runnable()
            mAsyncHandler.post(() -> ContentOperation.UPDATE_TIMEZONE.fire(getContext(), null));
            {
                @Override
                public void run()
                {
                    ContentOperation.UPDATE_TIMEZONE.fire(getContext(), null);
                }
            });
        }
        }
    }
    }


Loading