Target API 28

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2018-07-29 15:46:01 +02:00
parent b960b4a6cd
commit bce5d852e1
3 changed files with 13 additions and 13 deletions

View File

@ -11,12 +11,12 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8 sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8
} }
compileSdkVersion 27 compileSdkVersion 28
dataBinding.enabled true dataBinding.enabled true
defaultConfig { defaultConfig {
applicationId 'com.wireguard.android' applicationId 'com.wireguard.android'
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 27 targetSdkVersion 28
versionCode 437 versionCode 437
versionName '0.0.20180725' versionName '0.0.20180725'
buildConfigField 'int', 'MIN_SDK_VERSION', "$minSdkVersion.apiLevel" buildConfigField 'int', 'MIN_SDK_VERSION', "$minSdkVersion.apiLevel"

View File

@ -71,6 +71,7 @@ public class Application extends android.app.Application {
* check the DN of the certs that signed the apk, without even bothering to try * check the DN of the certs that signed the apk, without even bothering to try
* validating that they're authentic. It's a good enough heuristic. * validating that they're authentic. It's a good enough heuristic.
*/ */
@SuppressWarnings("deprecation")
@Nullable @Nullable
private static String getInstallSource(final Context context) { private static String getInstallSource(final Context context) {
if (BuildConfig.DEBUG) if (BuildConfig.DEBUG)

View File

@ -61,6 +61,10 @@ public class QuickTileService extends TileService {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@Override @Override
public void onCreate() { public void onCreate() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
iconOff = iconOn = Icon.createWithResource(this, R.drawable.ic_tile);
return;
}
final SlashDrawable icon = new SlashDrawable(getResources().getDrawable(R.drawable.ic_tile)); final SlashDrawable icon = new SlashDrawable(getResources().getDrawable(R.drawable.ic_tile));
icon.setAnimationEnabled(false); /* Unfortunately we can't have animations, since Icons are marshaled. */ icon.setAnimationEnabled(false); /* Unfortunately we can't have animations, since Icons are marshaled. */
icon.setSlashed(false); icon.setSlashed(false);
@ -69,17 +73,12 @@ public class QuickTileService extends TileService {
icon.setBounds(0, 0, c.getWidth(), c.getHeight()); icon.setBounds(0, 0, c.getWidth(), c.getHeight());
icon.draw(c); icon.draw(c);
iconOn = Icon.createWithBitmap(b); iconOn = Icon.createWithBitmap(b);
/* TODO(msf): Change this to an explicit test for P when we start targetting SDK 28 */ icon.setSlashed(true);
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.O_MR1) { b = Bitmap.createBitmap(icon.getIntrinsicWidth(), icon.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
iconOff = iconOn; c = new Canvas(b);
} else { icon.setBounds(0, 0, c.getWidth(), c.getHeight());
icon.setSlashed(true); icon.draw(c);
b = Bitmap.createBitmap(icon.getIntrinsicWidth(), icon.getIntrinsicHeight(), Bitmap.Config.ARGB_8888); iconOff = Icon.createWithBitmap(b);
c = new Canvas(b);
icon.setBounds(0, 0, c.getWidth(), c.getHeight());
icon.draw(c);
iconOff = Icon.createWithBitmap(b);
}
} }
@Override @Override