Compare commits

..

13 Commits
v0.54 ... v0.56

Author SHA1 Message Date
Fredrik Fornwall
02af113dda Bump app version to 0.56 2017-11-19 20:54:16 +01:00
Fredrik Fornwall
fc4ef838bf Configure proguard to keep line numbers 2017-11-19 20:53:56 +01:00
Fredrik Fornwall
86bd3ca21b Bump app version to 0.54 2017-11-19 15:27:17 +01:00
Fredrik Fornwall
367398bafb Update gradle configuration 2017-11-19 15:27:00 +01:00
Lauri Tirkkonen
dd502e55f8 set default notification priority to low
since we're a foreground service, in oreo we already get a higher
priority; see
https://developer.android.com/reference/android/app/NotificationManager.html#IMPORTANCE_MIN
2017-11-12 23:44:14 +01:00
Fredrik Fornwall
798125ef7a Remove outdated comment 2017-11-12 23:06:28 +01:00
Fredrik Fornwall
5126f06e06 Update .travis.yml to latest setup 2017-11-12 22:30:09 +01:00
Fredrik Fornwall
0bdbf314ef Update gradle configuration 2017-11-07 04:25:48 +01:00
Fredrik Fornwall
2deb9899bd Update buildToolsVersion to 27.0.1 2017-11-07 04:13:26 +01:00
Fredrik Fornwall
694ccc38c4 Remove WakefulBroadcastReceiver usage 2017-11-04 23:38:49 +01:00
Fredrik Fornwall
c949940374 Update support deps 2017-11-02 01:56:42 +01:00
Fredrik Fornwall
d09f70de1e Use a notification channel on Android O 2017-11-01 21:15:41 +01:00
Fredrik Fornwall
ac338ce2c5 Update gradle to 4.3 2017-10-31 19:07:00 +01:00
10 changed files with 52 additions and 45 deletions

View File

@@ -12,8 +12,8 @@ android:
components: components:
- platform-tools - platform-tools
- tools - tools
- build-tools-27.0.0 - build-tools-27.0.1
- android-26 - android-27
- extra-android-m2repository - extra-android-m2repository
before_install: before_install:

View File

@@ -1,22 +1,21 @@
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
android { android {
compileSdkVersion 26 compileSdkVersion 27
buildToolsVersion "27.0.0" buildToolsVersion "27.0.1"
dependencies { dependencies {
compile 'com.android.support:support-annotations:27.0.0' implementation 'com.android.support:support-annotations:27.0.0'
compile "com.android.support:support-core-utils:26.1.0" implementation "com.android.support:support-core-ui:27.0.0"
compile "com.android.support:support-core-ui:26.1.0" implementation project(":terminal-view")
compile project(":terminal-view")
} }
defaultConfig { defaultConfig {
applicationId "com.termux" applicationId "com.termux"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 26 targetSdkVersion 27
versionCode 54 versionCode 56
versionName "0.54" versionName "0.56"
} }
buildTypes { buildTypes {
@@ -29,5 +28,5 @@ android {
} }
dependencies { dependencies {
testCompile 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
} }

View File

@@ -7,11 +7,5 @@
# For more details, see # For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html # http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here: -renamesourcefileattribute SourceFile
-keepattributes SourceFile,LineNumberTable
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

View File

@@ -157,7 +157,6 @@ public final class TermuxActivity extends Activity implements ServiceConnection
void checkForFontAndColors() { void checkForFontAndColors() {
try { try {
// Hard-coded paths since this file is used also in Termux:Float.
@SuppressLint("SdCardPath") File fontFile = new File("/data/data/com.termux/files/home/.termux/font.ttf"); @SuppressLint("SdCardPath") File fontFile = new File("/data/data/com.termux/files/home/.termux/font.ttf");
@SuppressLint("SdCardPath") File colorsFile = new File("/data/data/com.termux/files/home/.termux/colors.properties"); @SuppressLint("SdCardPath") File colorsFile = new File("/data/data/com.termux/files/home/.termux/colors.properties");

View File

@@ -2,6 +2,7 @@ package com.termux.app;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.app.Notification; import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager; import android.app.NotificationManager;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.app.Service; import android.app.Service;
@@ -11,10 +12,10 @@ import android.content.res.Resources;
import android.net.Uri; import android.net.Uri;
import android.net.wifi.WifiManager; import android.net.wifi.WifiManager;
import android.os.Binder; import android.os.Binder;
import android.os.Build;
import android.os.Handler; import android.os.Handler;
import android.os.IBinder; import android.os.IBinder;
import android.os.PowerManager; import android.os.PowerManager;
import android.support.v4.content.WakefulBroadcastReceiver;
import android.util.Log; import android.util.Log;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
@@ -41,6 +42,8 @@ import java.util.List;
*/ */
public final class TermuxService extends Service implements SessionChangedCallback { public final class TermuxService extends Service implements SessionChangedCallback {
private static final String NOTIFICATION_CHANNEL_ID = "termux_notification_channel";
/** Note that this is a symlink on the Android M preview. */ /** Note that this is a symlink on the Android M preview. */
@SuppressLint("SdCardPath") @SuppressLint("SdCardPath")
public static final String FILES_PATH = "/data/data/com.termux/files"; public static final String FILES_PATH = "/data/data/com.termux/files";
@@ -153,11 +156,6 @@ public final class TermuxService extends Service implements SessionChangedCallba
Log.e(EmulatorDebug.LOG_TAG, "Unknown TermuxService action: '" + action + "'"); Log.e(EmulatorDebug.LOG_TAG, "Unknown TermuxService action: '" + action + "'");
} }
if ((flags & START_FLAG_REDELIVERY) == 0) {
// Service is started by WBR, not restarted by system, so release the WakeLock from WBR.
WakefulBroadcastReceiver.completeWakefulIntent(intent);
}
// If this service really do get killed, there is no point restarting it automatically - let the user do on next // If this service really do get killed, there is no point restarting it automatically - let the user do on next
// start of {@link Term): // start of {@link Term):
return Service.START_NOT_STICKY; return Service.START_NOT_STICKY;
@@ -170,6 +168,7 @@ public final class TermuxService extends Service implements SessionChangedCallba
@Override @Override
public void onCreate() { public void onCreate() {
setupNotificationChannel();
startForeground(NOTIFICATION_ID, buildNotification()); startForeground(NOTIFICATION_ID, buildNotification());
} }
@@ -208,8 +207,8 @@ public final class TermuxService extends Service implements SessionChangedCallba
builder.setOngoing(true); builder.setOngoing(true);
// If holding a wake or wifi lock consider the notification of high priority since it's using power, // If holding a wake or wifi lock consider the notification of high priority since it's using power,
// otherwise use a minimal priority since this is just a background service notification: // otherwise use a low priority
builder.setPriority((wakeLockHeld) ? Notification.PRIORITY_HIGH : Notification.PRIORITY_MIN); builder.setPriority((wakeLockHeld) ? Notification.PRIORITY_HIGH : Notification.PRIORITY_LOW);
// No need to show a timestamp: // No need to show a timestamp:
builder.setShowWhen(false); builder.setShowWhen(false);
@@ -217,6 +216,10 @@ public final class TermuxService extends Service implements SessionChangedCallba
// Background color for small notification icon: // Background color for small notification icon:
builder.setColor(0xFF000000); builder.setColor(0xFF000000);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
builder.setChannelId(NOTIFICATION_CHANNEL_ID);
}
Resources res = getResources(); Resources res = getResources();
Intent exitIntent = new Intent(this, TermuxService.class).setAction(ACTION_STOP_SERVICE); Intent exitIntent = new Intent(this, TermuxService.class).setAction(ACTION_STOP_SERVICE);
builder.addAction(android.R.drawable.ic_delete, res.getString(R.string.notification_action_exit), PendingIntent.getService(this, 0, exitIntent, 0)); builder.addAction(android.R.drawable.ic_delete, res.getString(R.string.notification_action_exit), PendingIntent.getService(this, 0, exitIntent, 0));
@@ -341,4 +344,17 @@ public final class TermuxService extends Service implements SessionChangedCallba
} }
}); });
} }
private void setupNotificationChannel() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return;
String channelName = "Termux";
String channelDescription = "Notifications from Termux";
int importance = NotificationManager.IMPORTANCE_LOW;
NotificationChannel channel = new NotificationChannel(NOTIFICATION_CHANNEL_ID, channelName,importance);
channel.setDescription(channelDescription);
NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
manager.createNotificationChannel(channel);
}
} }

Binary file not shown.

View File

@@ -1,4 +1,4 @@
distributionUrl=https\://services.gradle.org/distributions/gradle-4.2.1-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-4.3.1-bin.zip
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

View File

@@ -1,5 +1,4 @@
// Start https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle // Start https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle
apply plugin: 'com.github.dcendents.android-maven'
group = publishedGroupId // Maven Group ID for the artifact group = publishedGroupId // Maven Group ID for the artifact
install { install {
repositories.mavenInstaller { repositories.mavenInstaller {

View File

@@ -13,16 +13,16 @@ ext {
libraryDescription = 'The terminal emulator used in Termux' libraryDescription = 'The terminal emulator used in Termux'
siteUrl = 'https://github.com/termux/termux' siteUrl = 'https://github.com/termux/termux'
gitUrl = 'https://github.com/termux/termux.git' gitUrl = 'https://github.com/termux/termux.git'
libraryVersion = '0.51' libraryVersion = '0.52'
} }
android { android {
compileSdkVersion 26 compileSdkVersion 27
buildToolsVersion "27.0.0" buildToolsVersion "27.0.1"
defaultConfig { defaultConfig {
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 26 targetSdkVersion 27
externalNativeBuild { externalNativeBuild {
ndkBuild { ndkBuild {
@@ -56,7 +56,7 @@ tasks.withType(Test) {
} }
dependencies { dependencies {
testCompile 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
} }
apply from: '../scripts/bintray-publish.gradle' apply from: '../scripts/bintray-publish.gradle'

View File

@@ -1,6 +1,6 @@
plugins { plugins {
id "com.jfrog.bintray" version "1.7" id "com.jfrog.bintray" version "1.7.3"
id "com.github.dcendents.android-maven" version "1.5" id "com.github.dcendents.android-maven" version "2.0"
} }
apply plugin: 'com.android.library' apply plugin: 'com.android.library'
@@ -13,21 +13,21 @@ ext {
libraryDescription = 'The terminal view used in Termux' libraryDescription = 'The terminal view used in Termux'
siteUrl = 'https://github.com/termux/termux' siteUrl = 'https://github.com/termux/termux'
gitUrl = 'https://github.com/termux/termux.git' gitUrl = 'https://github.com/termux/termux.git'
libraryVersion = '0.49' libraryVersion = '0.50'
} }
android { android {
compileSdkVersion 26 compileSdkVersion 27
buildToolsVersion "27.0.0" buildToolsVersion "27.0.1"
dependencies { dependencies {
compile 'com.android.support:support-annotations:25.3.1' implementation 'com.android.support:support-annotations:27.0.0'
compile project(":terminal-emulator") api project(":terminal-emulator")
} }
defaultConfig { defaultConfig {
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 26 targetSdkVersion 27
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
} }
@@ -40,7 +40,7 @@ android {
} }
dependencies { dependencies {
testCompile 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
} }
apply from: '../scripts/bintray-publish.gradle' apply from: '../scripts/bintray-publish.gradle'