diff options
Diffstat (limited to 'Common/src/com/googlecode/android_scripting/facade/AndroidFacade.java')
-rw-r--r-- | Common/src/com/googlecode/android_scripting/facade/AndroidFacade.java | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/Common/src/com/googlecode/android_scripting/facade/AndroidFacade.java b/Common/src/com/googlecode/android_scripting/facade/AndroidFacade.java index 87b50cdd..1689c88a 100644 --- a/Common/src/com/googlecode/android_scripting/facade/AndroidFacade.java +++ b/Common/src/com/googlecode/android_scripting/facade/AndroidFacade.java @@ -44,6 +44,8 @@ import android.text.method.PasswordTransformationMethod; import android.widget.EditText; import android.widget.Toast; +import com.android.modules.utils.build.SdkLevel; + import com.googlecode.android_scripting.BaseApplication; import com.googlecode.android_scripting.FileUtils; import com.googlecode.android_scripting.FutureActivityTaskExecutor; @@ -600,6 +602,16 @@ public class AndroidFacade extends RpcReceiver { return Build.VERSION.SDK_INT; } + @Rpc(description = "Returns whether the device is running SDK at least R") + public boolean isSdkAtLeastR() { + return SdkLevel.isAtLeastR(); + } + + @Rpc(description = "Returns whether the device is running SDK at least S") + public boolean isSdkAtLeastS() { + return SdkLevel.isAtLeastS(); + } + @Rpc(description = "Returns the current device time.") public Long getBuildTime() { return Build.TIME; @@ -857,7 +869,8 @@ public class AndroidFacade extends RpcReceiver { @RpcParameter(name = "message") String message) { createNotificationChannel(); // This contentIntent is a noop. - PendingIntent contentIntent = PendingIntent.getService(mService, 0, new Intent(), 0); + PendingIntent contentIntent = PendingIntent.getService(mService, 0, new Intent(), + PendingIntent.FLAG_IMMUTABLE); Notification.Builder builder = new Notification.Builder(mService, CHANNEL_ID); builder.setSmallIcon(mResources.getLogo48()) .setTicker(message) |