summaryrefslogtreecommitdiff
path: root/core/java/android/app/ContextImpl.java
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/android/app/ContextImpl.java')
-rw-r--r--core/java/android/app/ContextImpl.java24
1 files changed, 24 insertions, 0 deletions
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java
index ab1190334eb0..60c028870d6a 100644
--- a/core/java/android/app/ContextImpl.java
+++ b/core/java/android/app/ContextImpl.java
@@ -1444,6 +1444,14 @@ class ContextImpl extends Context {
@Override
public ComponentName startServiceAsUser(Intent service, UserHandle user) {
try {
+ if (service.getComponent() == null && service.getPackage() == null) {
+ if (getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.KEY_LIME_PIE) {
+ IllegalArgumentException ex = new IllegalArgumentException(
+ "Service Intent must be explicit: " + service);
+ Log.wtf(TAG, "This will become an error", ex);
+ //throw ex;
+ }
+ }
service.prepareToLeaveProcess();
ComponentName cn = ActivityManagerNative.getDefault().startService(
mMainThread.getApplicationThread(), service,
@@ -1468,6 +1476,14 @@ class ContextImpl extends Context {
@Override
public boolean stopServiceAsUser(Intent service, UserHandle user) {
try {
+ if (service.getComponent() == null && service.getPackage() == null) {
+ if (getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.KEY_LIME_PIE) {
+ IllegalArgumentException ex = new IllegalArgumentException(
+ "Service Intent must be explicit: " + service);
+ Log.wtf(TAG, "This will become an error", ex);
+ //throw ex;
+ }
+ }
service.prepareToLeaveProcess();
int res = ActivityManagerNative.getDefault().stopService(
mMainThread.getApplicationThread(), service,
@@ -1503,6 +1519,14 @@ class ContextImpl extends Context {
} else {
throw new RuntimeException("Not supported in system context");
}
+ if (service.getComponent() == null && service.getPackage() == null) {
+ if (getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.KEY_LIME_PIE) {
+ IllegalArgumentException ex = new IllegalArgumentException(
+ "Service Intent must be explicit: " + service);
+ Log.wtf(TAG, "This will become an error", ex);
+ //throw ex;
+ }
+ }
try {
IBinder token = getActivityToken();
if (token == null && (flags&BIND_AUTO_CREATE) == 0 && mPackageInfo != null