mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
Improve Android stub fidelity to the point that all relevant tests work
Note these still aren't entirely mechanically generated stubs matching the real Android 9.
This commit is contained in:
@@ -5,34 +5,34 @@
|
||||
| A.java:41:5:41:53 | getInputStream(...) | A.java:41:5:41:53 | getInputStream(...) |
|
||||
| A.java:42:5:42:45 | getInputStream(...) | A.java:42:5:42:45 | getInputStream(...) |
|
||||
| A.java:43:5:43:47 | getHostName(...) | A.java:43:5:43:47 | getHostName(...) |
|
||||
| IntentSources.java:9:20:9:35 | getIntent(...) | ../../../stubs/google-android-9.0.0/android/content/Intent.java:1564:19:1564:32 | [summary] read: <map.value> of android.content.Intent.extras of argument -1 in getStringExtra |
|
||||
| IntentSources.java:9:20:9:35 | getIntent(...) | ../../../stubs/google-android-9.0.0/android/content/Intent.java:1564:19:1564:32 | [summary] read: android.content.Intent.extras of argument -1 in getStringExtra |
|
||||
| IntentSources.java:9:20:9:35 | getIntent(...) | ../../../stubs/google-android-9.0.0/android/content/Intent.java:1564:19:1564:32 | [summary] to write: return (return) in getStringExtra |
|
||||
| IntentSources.java:9:20:9:35 | getIntent(...) | ../../../stubs/google-android-9.0.0/android/content/Intent.java:1564:19:1564:32 | parameter this |
|
||||
| IntentSources.java:9:20:9:35 | getIntent(...) | ../../../stubs/google-android-9.0.0/android/content/Intent.java:105:19:105:32 | [summary] read: <map.value> of android.content.Intent.extras of argument -1 in getStringExtra |
|
||||
| IntentSources.java:9:20:9:35 | getIntent(...) | ../../../stubs/google-android-9.0.0/android/content/Intent.java:105:19:105:32 | [summary] read: android.content.Intent.extras of argument -1 in getStringExtra |
|
||||
| IntentSources.java:9:20:9:35 | getIntent(...) | ../../../stubs/google-android-9.0.0/android/content/Intent.java:105:19:105:32 | [summary] to write: return (return) in getStringExtra |
|
||||
| IntentSources.java:9:20:9:35 | getIntent(...) | ../../../stubs/google-android-9.0.0/android/content/Intent.java:105:19:105:32 | parameter this |
|
||||
| IntentSources.java:9:20:9:35 | getIntent(...) | IntentSources.java:9:20:9:35 | getIntent(...) |
|
||||
| IntentSources.java:9:20:9:35 | getIntent(...) | IntentSources.java:9:20:9:57 | getStringExtra(...) |
|
||||
| IntentSources.java:9:20:9:35 | getIntent(...) | IntentSources.java:10:29:10:35 | trouble |
|
||||
| IntentSources.java:16:20:16:30 | getIntent(...) | ../../../stubs/google-android-9.0.0/android/content/Intent.java:1564:19:1564:32 | [summary] read: <map.value> of android.content.Intent.extras of argument -1 in getStringExtra |
|
||||
| IntentSources.java:16:20:16:30 | getIntent(...) | ../../../stubs/google-android-9.0.0/android/content/Intent.java:1564:19:1564:32 | [summary] read: android.content.Intent.extras of argument -1 in getStringExtra |
|
||||
| IntentSources.java:16:20:16:30 | getIntent(...) | ../../../stubs/google-android-9.0.0/android/content/Intent.java:1564:19:1564:32 | [summary] to write: return (return) in getStringExtra |
|
||||
| IntentSources.java:16:20:16:30 | getIntent(...) | ../../../stubs/google-android-9.0.0/android/content/Intent.java:1564:19:1564:32 | parameter this |
|
||||
| IntentSources.java:16:20:16:30 | getIntent(...) | ../../../stubs/google-android-9.0.0/android/content/Intent.java:105:19:105:32 | [summary] read: <map.value> of android.content.Intent.extras of argument -1 in getStringExtra |
|
||||
| IntentSources.java:16:20:16:30 | getIntent(...) | ../../../stubs/google-android-9.0.0/android/content/Intent.java:105:19:105:32 | [summary] read: android.content.Intent.extras of argument -1 in getStringExtra |
|
||||
| IntentSources.java:16:20:16:30 | getIntent(...) | ../../../stubs/google-android-9.0.0/android/content/Intent.java:105:19:105:32 | [summary] to write: return (return) in getStringExtra |
|
||||
| IntentSources.java:16:20:16:30 | getIntent(...) | ../../../stubs/google-android-9.0.0/android/content/Intent.java:105:19:105:32 | parameter this |
|
||||
| IntentSources.java:16:20:16:30 | getIntent(...) | IntentSources.java:16:20:16:30 | getIntent(...) |
|
||||
| IntentSources.java:16:20:16:30 | getIntent(...) | IntentSources.java:16:20:16:52 | getStringExtra(...) |
|
||||
| IntentSources.java:16:20:16:30 | getIntent(...) | IntentSources.java:17:29:17:35 | trouble |
|
||||
| IntentSources.java:23:20:23:30 | getIntent(...) | ../../../stubs/google-android-9.0.0/android/content/Intent.java:1863:19:1863:27 | [summary] read: android.content.Intent.extras of argument -1 in getExtras |
|
||||
| IntentSources.java:23:20:23:30 | getIntent(...) | ../../../stubs/google-android-9.0.0/android/content/Intent.java:1863:19:1863:27 | [summary] to write: return (return) in getExtras |
|
||||
| IntentSources.java:23:20:23:30 | getIntent(...) | ../../../stubs/google-android-9.0.0/android/content/Intent.java:1863:19:1863:27 | parameter this |
|
||||
| IntentSources.java:23:20:23:30 | getIntent(...) | ../../../stubs/google-android-9.0.0/android/os/BaseBundle.java:600:19:600:27 | [summary] read: <map.value> of argument -1 in getString |
|
||||
| IntentSources.java:23:20:23:30 | getIntent(...) | ../../../stubs/google-android-9.0.0/android/os/BaseBundle.java:600:19:600:27 | [summary] to write: return (return) in getString |
|
||||
| IntentSources.java:23:20:23:30 | getIntent(...) | ../../../stubs/google-android-9.0.0/android/os/BaseBundle.java:600:19:600:27 | parameter this |
|
||||
| IntentSources.java:23:20:23:30 | getIntent(...) | ../../../stubs/google-android-9.0.0/android/content/Intent.java:33:19:33:27 | [summary] read: android.content.Intent.extras of argument -1 in getExtras |
|
||||
| IntentSources.java:23:20:23:30 | getIntent(...) | ../../../stubs/google-android-9.0.0/android/content/Intent.java:33:19:33:27 | [summary] to write: return (return) in getExtras |
|
||||
| IntentSources.java:23:20:23:30 | getIntent(...) | ../../../stubs/google-android-9.0.0/android/content/Intent.java:33:19:33:27 | parameter this |
|
||||
| IntentSources.java:23:20:23:30 | getIntent(...) | ../../../stubs/google-android-9.0.0/android/os/BaseBundle.java:12:19:12:27 | [summary] read: <map.value> of argument -1 in getString |
|
||||
| IntentSources.java:23:20:23:30 | getIntent(...) | ../../../stubs/google-android-9.0.0/android/os/BaseBundle.java:12:19:12:27 | [summary] to write: return (return) in getString |
|
||||
| IntentSources.java:23:20:23:30 | getIntent(...) | ../../../stubs/google-android-9.0.0/android/os/BaseBundle.java:12:19:12:27 | parameter this |
|
||||
| IntentSources.java:23:20:23:30 | getIntent(...) | IntentSources.java:23:20:23:30 | getIntent(...) |
|
||||
| IntentSources.java:23:20:23:30 | getIntent(...) | IntentSources.java:23:20:23:42 | getExtras(...) |
|
||||
| IntentSources.java:23:20:23:30 | getIntent(...) | IntentSources.java:23:20:23:59 | getString(...) |
|
||||
| IntentSources.java:23:20:23:30 | getIntent(...) | IntentSources.java:24:29:24:35 | trouble |
|
||||
| IntentSources.java:33:20:33:33 | getIntent(...) | ../../../stubs/google-android-9.0.0/android/content/Intent.java:1564:19:1564:32 | [summary] read: <map.value> of android.content.Intent.extras of argument -1 in getStringExtra |
|
||||
| IntentSources.java:33:20:33:33 | getIntent(...) | ../../../stubs/google-android-9.0.0/android/content/Intent.java:1564:19:1564:32 | [summary] read: android.content.Intent.extras of argument -1 in getStringExtra |
|
||||
| IntentSources.java:33:20:33:33 | getIntent(...) | ../../../stubs/google-android-9.0.0/android/content/Intent.java:1564:19:1564:32 | [summary] to write: return (return) in getStringExtra |
|
||||
| IntentSources.java:33:20:33:33 | getIntent(...) | ../../../stubs/google-android-9.0.0/android/content/Intent.java:1564:19:1564:32 | parameter this |
|
||||
| IntentSources.java:33:20:33:33 | getIntent(...) | ../../../stubs/google-android-9.0.0/android/content/Intent.java:105:19:105:32 | [summary] read: <map.value> of android.content.Intent.extras of argument -1 in getStringExtra |
|
||||
| IntentSources.java:33:20:33:33 | getIntent(...) | ../../../stubs/google-android-9.0.0/android/content/Intent.java:105:19:105:32 | [summary] read: android.content.Intent.extras of argument -1 in getStringExtra |
|
||||
| IntentSources.java:33:20:33:33 | getIntent(...) | ../../../stubs/google-android-9.0.0/android/content/Intent.java:105:19:105:32 | [summary] to write: return (return) in getStringExtra |
|
||||
| IntentSources.java:33:20:33:33 | getIntent(...) | ../../../stubs/google-android-9.0.0/android/content/Intent.java:105:19:105:32 | parameter this |
|
||||
| IntentSources.java:33:20:33:33 | getIntent(...) | IntentSources.java:33:20:33:33 | getIntent(...) |
|
||||
| IntentSources.java:33:20:33:33 | getIntent(...) | IntentSources.java:33:20:33:55 | getStringExtra(...) |
|
||||
| IntentSources.java:33:20:33:33 | getIntent(...) | IntentSources.java:34:29:34:35 | trouble |
|
||||
|
||||
38
java/ql/test/stubs/google-android-9.0.0/android/annotation/StyleRes.java
generated
Normal file
38
java/ql/test/stubs/google-android-9.0.0/android/annotation/StyleRes.java
generated
Normal file
@@ -0,0 +1,38 @@
|
||||
|
||||
/*
|
||||
* Copyright (C) 2013 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package android.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.FIELD;
|
||||
import static java.lang.annotation.ElementType.METHOD;
|
||||
import static java.lang.annotation.ElementType.PARAMETER;
|
||||
import static java.lang.annotation.RetentionPolicy.SOURCE;
|
||||
|
||||
/**
|
||||
* Denotes that a integer parameter, field or method return value is expected
|
||||
* to be a style resource reference (e.g. {@link android.R.style#TextAppearance}).
|
||||
*
|
||||
* {@hide}
|
||||
*/
|
||||
@Documented
|
||||
@Retention(SOURCE)
|
||||
@Target({METHOD, PARAMETER, FIELD})
|
||||
public @interface StyleRes {
|
||||
}
|
||||
@@ -15,11 +15,10 @@
|
||||
*/
|
||||
package android.app;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.ContextWrapper;
|
||||
import android.content.Intent;
|
||||
import android.content.ComponentCallbacks2;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.*;
|
||||
|
||||
/**
|
||||
* An activity is a single, focused thing that the user can do. Almost all
|
||||
@@ -189,7 +188,7 @@ import android.view.View;
|
||||
* </p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* <pre class="prettyprint">
|
||||
* public class Activity extends ApplicationContext {
|
||||
* protected void onCreate(Bundle savedInstanceState);
|
||||
@@ -677,16 +676,7 @@ import android.view.View;
|
||||
* upload, independent of whether the original activity is paused, stopped, or
|
||||
* finished.
|
||||
*/
|
||||
public class Activity extends ContextWrapper {
|
||||
/** Standard activity result: operation canceled. */
|
||||
public static final int RESULT_CANCELED = 0;
|
||||
|
||||
/** Standard activity result: operation succeeded. */
|
||||
public static final int RESULT_OK = -1;
|
||||
|
||||
/** Start of user-defined activity results. */
|
||||
public static final int RESULT_FIRST_USER = 1;
|
||||
|
||||
public class Activity extends ContextThemeWrapper {
|
||||
/** Return the intent that started this activity. */
|
||||
public Intent getIntent() {
|
||||
return null;
|
||||
@@ -1154,36 +1144,7 @@ public class Activity extends ContextWrapper {
|
||||
public void startActivities(Intent[] intents, Bundle options) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when an activity you launched exits, giving you the requestCode
|
||||
* you started it with, the resultCode it returned, and any additional
|
||||
* data from it. The <var>resultCode</var> will be
|
||||
* {@link #RESULT_CANCELED} if the activity explicitly returned that,
|
||||
* didn't return any result, or crashed during its operation.
|
||||
*
|
||||
* <p>An activity can never receive a result in the resumed state. You can count on
|
||||
* {@link #onResume} being called after this method, though not necessarily immediately after.
|
||||
* If the activity was resumed, it will be paused and the result will be delivered, followed
|
||||
* by {@link #onResume}. If the activity wasn't in the resumed state, then the result will
|
||||
* be delivered, with {@link #onResume} called sometime later when the activity becomes active
|
||||
* again.
|
||||
*
|
||||
* <p>This method is never invoked if your activity sets
|
||||
* {@link android.R.styleable#AndroidManifestActivity_noHistory noHistory} to
|
||||
* <code>true</code>.
|
||||
*
|
||||
* @param requestCode The integer request code originally supplied to
|
||||
* startActivityForResult(), allowing you to identify who this
|
||||
* result came from.
|
||||
* @param resultCode The integer result code returned by the child activity
|
||||
* through its setResult().
|
||||
* @param data An Intent, which can return result data to the caller
|
||||
* (various data can be attached to Intent "extras").
|
||||
*
|
||||
* @see #startActivityForResult
|
||||
* @see #createPendingResult
|
||||
* @see #setResult(int)
|
||||
*/
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
}
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) { }
|
||||
|
||||
public static final int RESULT_OK = -1;
|
||||
}
|
||||
|
||||
@@ -1,255 +1,46 @@
|
||||
/*
|
||||
* Copyright (C) 2006 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Generated automatically from android.content.BroadcastReceiver for testing purposes
|
||||
|
||||
package android.content;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
/**
|
||||
* Base class for code that will receive intents sent by sendBroadcast().
|
||||
*
|
||||
* <p>If you don't need to send broadcasts across applications, consider using
|
||||
* this class with {@link android.support.v4.content.LocalBroadcastManager} instead
|
||||
* of the more general facilities described below. This will give you a much
|
||||
* more efficient implementation (no cross-process communication needed) and allow
|
||||
* you to avoid thinking about any security issues related to other applications
|
||||
* being able to receive or send your broadcasts.
|
||||
*
|
||||
* <p>You can either dynamically register an instance of this class with
|
||||
* {@link Context#registerReceiver Context.registerReceiver()}
|
||||
* or statically publish an implementation through the
|
||||
* {@link android.R.styleable#AndroidManifestReceiver <receiver>}
|
||||
* tag in your <code>AndroidManifest.xml</code>.
|
||||
*
|
||||
* <p><em><strong>Note:</strong></em>
|
||||
* If registering a receiver in your
|
||||
* {@link android.app.Activity#onResume() Activity.onResume()}
|
||||
* implementation, you should unregister it in
|
||||
* {@link android.app.Activity#onPause() Activity.onPause()}.
|
||||
* (You won't receive intents when paused,
|
||||
* and this will cut down on unnecessary system overhead). Do not unregister in
|
||||
* {@link android.app.Activity#onSaveInstanceState(android.os.Bundle) Activity.onSaveInstanceState()},
|
||||
* because this won't be called if the user moves back in the history
|
||||
* stack.
|
||||
*
|
||||
* <p>There are two major classes of broadcasts that can be received:</p>
|
||||
* <ul>
|
||||
* <li> <b>Normal broadcasts</b> (sent with {@link Context#sendBroadcast(Intent)
|
||||
* Context.sendBroadcast}) are completely asynchronous. All receivers of the
|
||||
* broadcast are run in an undefined order, often at the same time. This is
|
||||
* more efficient, but means that receivers cannot use the result or abort
|
||||
* APIs included here.
|
||||
* <li> <b>Ordered broadcasts</b> (sent with {@link Context#sendOrderedBroadcast(Intent, String)
|
||||
* Context.sendOrderedBroadcast}) are delivered to one receiver at a time.
|
||||
* As each receiver executes in turn, it can propagate a result to the next
|
||||
* receiver, or it can completely abort the broadcast so that it won't be passed
|
||||
* to other receivers. The order receivers run in can be controlled with the
|
||||
* {@link android.R.styleable#AndroidManifestIntentFilter_priority
|
||||
* android:priority} attribute of the matching intent-filter; receivers with
|
||||
* the same priority will be run in an arbitrary order.
|
||||
* </ul>
|
||||
*
|
||||
* <p>Even in the case of normal broadcasts, the system may in some
|
||||
* situations revert to delivering the broadcast one receiver at a time. In
|
||||
* particular, for receivers that may require the creation of a process, only
|
||||
* one will be run at a time to avoid overloading the system with new processes.
|
||||
* In this situation, however, the non-ordered semantics hold: these receivers still
|
||||
* cannot return results or abort their broadcast.</p>
|
||||
*
|
||||
* <p>Note that, although the Intent class is used for sending and receiving
|
||||
* these broadcasts, the Intent broadcast mechanism here is completely separate
|
||||
* from Intents that are used to start Activities with
|
||||
* {@link Context#startActivity Context.startActivity()}.
|
||||
* There is no way for a BroadcastReceiver
|
||||
* to see or capture Intents used with startActivity(); likewise, when
|
||||
* you broadcast an Intent, you will never find or start an Activity.
|
||||
* These two operations are semantically very different: starting an
|
||||
* Activity with an Intent is a foreground operation that modifies what the
|
||||
* user is currently interacting with; broadcasting an Intent is a background
|
||||
* operation that the user is not normally aware of.
|
||||
*
|
||||
* <p>The BroadcastReceiver class (when launched as a component through
|
||||
* a manifest's {@link android.R.styleable#AndroidManifestReceiver <receiver>}
|
||||
* tag) is an important part of an
|
||||
* <a href="{@docRoot}guide/topics/fundamentals.html#lcycles">application's overall lifecycle</a>.</p>
|
||||
*
|
||||
* <p>Topics covered here:
|
||||
* <ol>
|
||||
* <li><a href="#Security">Security</a>
|
||||
* <li><a href="#ReceiverLifecycle">Receiver Lifecycle</a>
|
||||
* <li><a href="#ProcessLifecycle">Process Lifecycle</a>
|
||||
* </ol>
|
||||
*
|
||||
* <div class="special reference">
|
||||
* <h3>Developer Guides</h3>
|
||||
* <p>For information about how to use this class to receive and resolve intents, read the
|
||||
* <a href="{@docRoot}guide/topics/intents/intents-filters.html">Intents and Intent Filters</a>
|
||||
* developer guide.</p>
|
||||
* </div>
|
||||
*
|
||||
* <a name="Security"></a>
|
||||
* <h3>Security</h3>
|
||||
*
|
||||
* <p>Receivers used with the {@link Context} APIs are by their nature a
|
||||
* cross-application facility, so you must consider how other applications
|
||||
* may be able to abuse your use of them. Some things to consider are:
|
||||
*
|
||||
* <ul>
|
||||
* <li><p>The Intent namespace is global. Make sure that Intent action names and
|
||||
* other strings are written in a namespace you own, or else you may inadvertantly
|
||||
* conflict with other applications.
|
||||
* <li><p>When you use {@link Context#registerReceiver(BroadcastReceiver, IntentFilter)},
|
||||
* <em>any</em> application may send broadcasts to that registered receiver. You can
|
||||
* control who can send broadcasts to it through permissions described below.
|
||||
* <li><p>When you publish a receiver in your application's manifest and specify
|
||||
* intent-filters for it, any other application can send broadcasts to it regardless
|
||||
* of the filters you specify. To prevent others from sending to it, make it
|
||||
* unavailable to them with <code>android:exported="false"</code>.
|
||||
* <li><p>When you use {@link Context#sendBroadcast(Intent)} or related methods,
|
||||
* normally any other application can receive these broadcasts. You can control who
|
||||
* can receive such broadcasts through permissions described below. Alternatively,
|
||||
* starting with {@link android.os.Build.VERSION_CODES#ICE_CREAM_SANDWICH}, you
|
||||
* can also safely restrict the broadcast to a single application with
|
||||
* {@link Intent#setPackage(String) Intent.setPackage}
|
||||
* </ul>
|
||||
*
|
||||
* <p>None of these issues exist when using
|
||||
* {@link android.support.v4.content.LocalBroadcastManager}, since intents
|
||||
* broadcast it never go outside of the current process.
|
||||
*
|
||||
* <p>Access permissions can be enforced by either the sender or receiver
|
||||
* of a broadcast.
|
||||
*
|
||||
* <p>To enforce a permission when sending, you supply a non-null
|
||||
* <var>permission</var> argument to
|
||||
* {@link Context#sendBroadcast(Intent, String)} or
|
||||
* {@link Context#sendOrderedBroadcast(Intent, String, BroadcastReceiver, android.os.Handler, int, String, Bundle)}.
|
||||
* Only receivers who have been granted this permission
|
||||
* (by requesting it with the
|
||||
* {@link android.R.styleable#AndroidManifestUsesPermission <uses-permission>}
|
||||
* tag in their <code>AndroidManifest.xml</code>) will be able to receive
|
||||
* the broadcast.
|
||||
*
|
||||
* <p>To enforce a permission when receiving, you supply a non-null
|
||||
* <var>permission</var> when registering your receiver -- either when calling
|
||||
* {@link Context#registerReceiver(BroadcastReceiver, IntentFilter, String, android.os.Handler)}
|
||||
* or in the static
|
||||
* {@link android.R.styleable#AndroidManifestReceiver <receiver>}
|
||||
* tag in your <code>AndroidManifest.xml</code>. Only broadcasters who have
|
||||
* been granted this permission (by requesting it with the
|
||||
* {@link android.R.styleable#AndroidManifestUsesPermission <uses-permission>}
|
||||
* tag in their <code>AndroidManifest.xml</code>) will be able to send an
|
||||
* Intent to the receiver.
|
||||
*
|
||||
* <p>See the <a href="{@docRoot}guide/topics/security/security.html">Security and Permissions</a>
|
||||
* document for more information on permissions and security in general.
|
||||
*
|
||||
* <a name="ReceiverLifecycle"></a>
|
||||
* <h3>Receiver Lifecycle</h3>
|
||||
*
|
||||
* <p>A BroadcastReceiver object is only valid for the duration of the call
|
||||
* to {@link #onReceive}. Once your code returns from this function,
|
||||
* the system considers the object to be finished and no longer active.
|
||||
*
|
||||
* <p>This has important repercussions to what you can do in an
|
||||
* {@link #onReceive} implementation: anything that requires asynchronous
|
||||
* operation is not available, because you will need to return from the
|
||||
* function to handle the asynchronous operation, but at that point the
|
||||
* BroadcastReceiver is no longer active and thus the system is free to kill
|
||||
* its process before the asynchronous operation completes.
|
||||
*
|
||||
* <p>In particular, you may <i>not</i> show a dialog or bind to a service from
|
||||
* within a BroadcastReceiver. For the former, you should instead use the
|
||||
* {@link android.app.NotificationManager} API. For the latter, you can
|
||||
* use {@link android.content.Context#startService Context.startService()} to
|
||||
* send a command to the service.
|
||||
*
|
||||
* <a name="ProcessLifecycle"></a>
|
||||
* <h3>Process Lifecycle</h3>
|
||||
*
|
||||
* <p>A process that is currently executing a BroadcastReceiver (that is,
|
||||
* currently running the code in its {@link #onReceive} method) is
|
||||
* considered to be a foreground process and will be kept running by the
|
||||
* system except under cases of extreme memory pressure.
|
||||
*
|
||||
* <p>Once you return from onReceive(), the BroadcastReceiver is no longer
|
||||
* active, and its hosting process is only as important as any other application
|
||||
* components that are running in it. This is especially important because if
|
||||
* that process was only hosting the BroadcastReceiver (a common case for
|
||||
* applications that the user has never or not recently interacted with), then
|
||||
* upon returning from onReceive() the system will consider its process
|
||||
* to be empty and aggressively kill it so that resources are available for other
|
||||
* more important processes.
|
||||
*
|
||||
* <p>This means that for longer-running operations you will often use
|
||||
* a {@link android.app.Service} in conjunction with a BroadcastReceiver to keep
|
||||
* the containing process active for the entire time of your operation.
|
||||
*/
|
||||
public abstract class BroadcastReceiver {
|
||||
|
||||
/**
|
||||
* State for a result that is pending for a broadcast receiver. Returned
|
||||
* by {@link BroadcastReceiver#goAsync() goAsync()}
|
||||
* while in {@link BroadcastReceiver#onReceive BroadcastReceiver.onReceive()}.
|
||||
* This allows you to return from onReceive() without having the broadcast
|
||||
* terminate; you must call {@link #finish()} once you are done with the
|
||||
* broadcast. This allows you to process the broadcast off of the main
|
||||
* thread of your app.
|
||||
*
|
||||
* <p>Note on threading: the state inside of this class is not itself
|
||||
* thread-safe, however you can use it from any thread if you properly
|
||||
* sure that you do not have races. Typically this means you will hand
|
||||
* the entire object to another thread, which will be solely responsible
|
||||
* for setting any results and finally calling {@link #finish()}.
|
||||
*/
|
||||
|
||||
public BroadcastReceiver() {
|
||||
import android.os.IBinder;
|
||||
|
||||
abstract public class BroadcastReceiver
|
||||
{
|
||||
public BroadcastReceiver(){}
|
||||
public IBinder peekService(Context p0, Intent p1){ return null; }
|
||||
public abstract void onReceive(Context p0, Intent p1);
|
||||
public final BroadcastReceiver.PendingResult goAsync(){ return null; }
|
||||
public final Bundle getResultExtras(boolean p0){ return null; }
|
||||
public final String getResultData(){ return null; }
|
||||
public final boolean getAbortBroadcast(){ return false; }
|
||||
public final boolean getDebugUnregister(){ return false; }
|
||||
public final boolean isInitialStickyBroadcast(){ return false; }
|
||||
public final boolean isOrderedBroadcast(){ return false; }
|
||||
public final int getResultCode(){ return 0; }
|
||||
public final void abortBroadcast(){}
|
||||
public final void clearAbortBroadcast(){}
|
||||
public final void setDebugUnregister(boolean p0){}
|
||||
public final void setOrderedHint(boolean p0){}
|
||||
public final void setResult(int p0, String p1, Bundle p2){}
|
||||
public final void setResultCode(int p0){}
|
||||
public final void setResultData(String p0){}
|
||||
public final void setResultExtras(Bundle p0){}
|
||||
static public class PendingResult
|
||||
{
|
||||
protected PendingResult() {}
|
||||
public final Bundle getResultExtras(boolean p0){ return null; }
|
||||
public final String getResultData(){ return null; }
|
||||
public final boolean getAbortBroadcast(){ return false; }
|
||||
public final int getResultCode(){ return 0; }
|
||||
public final void abortBroadcast(){}
|
||||
public final void clearAbortBroadcast(){}
|
||||
public final void finish(){}
|
||||
public final void setResult(int p0, String p1, Bundle p2){}
|
||||
public final void setResultCode(int p0){}
|
||||
public final void setResultData(String p0){}
|
||||
public final void setResultExtras(Bundle p0){}
|
||||
}
|
||||
/**
|
||||
* This method is called when the BroadcastReceiver is receiving an Intent
|
||||
* broadcast. During this time you can use the other methods on
|
||||
* BroadcastReceiver to view/modify the current result values. This method
|
||||
* is always called within the main thread of its process, unless you
|
||||
* explicitly asked for it to be scheduled on a different thread using
|
||||
* {@link android.content.Context#registerReceiver(BroadcastReceiver,
|
||||
* IntentFilter, String, android.os.Handler)}. When it runs on the main
|
||||
* thread you should
|
||||
* never perform long-running operations in it (there is a timeout of
|
||||
* 10 seconds that the system allows before considering the receiver to
|
||||
* be blocked and a candidate to be killed). You cannot launch a popup dialog
|
||||
* in your implementation of onReceive().
|
||||
*
|
||||
* <p><b>If this BroadcastReceiver was launched through a <receiver> tag,
|
||||
* then the object is no longer alive after returning from this
|
||||
* function.</b> This means you should not perform any operations that
|
||||
* return a result to you asynchronously -- in particular, for interacting
|
||||
* with services, you should use
|
||||
* {@link Context#startService(Intent)} instead of
|
||||
* {@link Context#bindService(Intent, ServiceConnection, int)}. If you wish
|
||||
* to interact with a service that is already running, you can use
|
||||
* {@link #peekService}.
|
||||
*
|
||||
* <p>The Intent filters used in {@link android.content.Context#registerReceiver}
|
||||
* and in application manifests are <em>not</em> guaranteed to be exclusive. They
|
||||
* are hints to the operating system about how to find suitable recipients. It is
|
||||
* possible for senders to force delivery to specific recipients, bypassing filter
|
||||
* resolution. For this reason, {@link #onReceive(Context, Intent) onReceive()}
|
||||
* implementations should respond only to known actions, ignoring any unexpected
|
||||
* Intents that they may receive.
|
||||
*
|
||||
* @param context The Context in which the receiver is running.
|
||||
* @param intent The Intent being received.
|
||||
*/
|
||||
public abstract void onReceive(Context context, Intent intent);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,29 +1,35 @@
|
||||
/*
|
||||
* Copyright (C) 2006 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Generated automatically from android.content.ComponentName for testing purposes
|
||||
|
||||
package android.content;
|
||||
|
||||
/**
|
||||
* Identifier for a specific application component
|
||||
* ({@link android.app.Activity}, {@link android.app.Service},
|
||||
* {@link android.content.BroadcastReceiver}, or
|
||||
* {@link android.content.ContentProvider}) that is available. Two
|
||||
* pieces of information, encapsulated here, are required to identify
|
||||
* a component: the package (a String) it exists in, and the class (a String)
|
||||
* name inside of that package.
|
||||
*
|
||||
*/
|
||||
public final class ComponentName {
|
||||
import android.content.Context;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
public class ComponentName implements Cloneable, Comparable<ComponentName>, Parcelable
|
||||
{
|
||||
protected ComponentName() {}
|
||||
public ComponentName clone(){ return null; }
|
||||
public ComponentName(Context p0, Class<? extends Object> p1){}
|
||||
public ComponentName(Context p0, String p1){}
|
||||
public ComponentName(Parcel p0){}
|
||||
public ComponentName(String p0, String p1){}
|
||||
public String flattenToShortString(){ return null; }
|
||||
public String flattenToString(){ return null; }
|
||||
public String getClassName(){ return null; }
|
||||
public String getPackageName(){ return null; }
|
||||
public String getShortClassName(){ return null; }
|
||||
public String toShortString(){ return null; }
|
||||
public String toString(){ return null; }
|
||||
public boolean equals(Object p0){ return false; }
|
||||
public int compareTo(ComponentName p0){ return 0; }
|
||||
public int describeContents(){ return 0; }
|
||||
public int hashCode(){ return 0; }
|
||||
public static ComponentName createRelative(Context p0, String p1){ return null; }
|
||||
public static ComponentName createRelative(String p0, String p1){ return null; }
|
||||
public static ComponentName readFromParcel(Parcel p0){ return null; }
|
||||
public static ComponentName unflattenFromString(String p0){ return null; }
|
||||
public static Parcelable.Creator<ComponentName> CREATOR = null;
|
||||
public static void writeToParcel(ComponentName p0, Parcel p1){}
|
||||
public void writeToParcel(Parcel p0, int p1){}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -15,8 +15,38 @@
|
||||
*/
|
||||
package android.content;
|
||||
|
||||
import java.io.File;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ComponentCallbacks;
|
||||
import android.content.ComponentName;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.IntentSender;
|
||||
import android.content.ServiceConnection;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.AssetManager;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.TypedArray;
|
||||
import android.database.DatabaseErrorHandler;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.UserHandle;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.Display;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
/**
|
||||
* Proxying implementation of Context that simply delegates all of its calls to
|
||||
@@ -29,106 +59,6 @@ public class ContextWrapper extends Context {
|
||||
|
||||
public ContextWrapper(Context base) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Context getApplicationContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getFileStreamPath(String name) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SharedPreferences getSharedPreferences(String name, int mode) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getSharedPrefsFile(String name) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] fileList() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getDataDir() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getFilesDir() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getNoBackupFilesDir() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getExternalFilesDir(String type) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public File[] getExternalFilesDirs(String type) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getObbDir() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public File[] getObbDirs() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getCacheDir() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getCodeCacheDir() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getExternalCacheDir() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public File[] getExternalCacheDirs() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public File[] getExternalMediaDirs() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getDir(String name, int mode) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @hide **/
|
||||
@Override
|
||||
public File getPreloadsFileCache() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startActivity(Intent intent) {
|
||||
}
|
||||
|
||||
/** @hide **/
|
||||
public void startActivityForResult(
|
||||
@@ -139,48 +69,110 @@ public class ContextWrapper extends Context {
|
||||
public boolean canStartActivityForResult() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
|
||||
public void startActivity(Intent intent, Bundle options) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startActivities(Intent[] intents) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startActivities(Intent[] intents, Bundle options) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendBroadcast(Intent intent) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendBroadcast(Intent intent, String receiverPermission) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendBroadcastWithMultiplePermissions(Intent intent, String[] receiverPermissions) {
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
@Override
|
||||
public void sendBroadcast(Intent intent, String receiverPermission, int appOp) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendOrderedBroadcast(Intent intent,
|
||||
String receiverPermission) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ComponentName startService(Intent service) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ComponentName startForegroundService(Intent service) {
|
||||
return null;
|
||||
}
|
||||
@Override public ApplicationInfo getApplicationInfo() { return null; }
|
||||
@Override public AssetManager getAssets() { return null; }
|
||||
@Override public ClassLoader getClassLoader() { return null; }
|
||||
@Override public ComponentName startForegroundService(Intent p0) { return null; }
|
||||
@Override public ComponentName startService(Intent p0) { return null; }
|
||||
@Override public ContentResolver getContentResolver() { return null; }
|
||||
@Override public Context createConfigurationContext(Configuration p0) { return null; }
|
||||
@Override public Context createContextForSplit(String p0) { return null; }
|
||||
@Override public Context createDeviceProtectedStorageContext() { return null; }
|
||||
@Override public Context createDisplayContext(Display p0) { return null; }
|
||||
@Override public Context createPackageContext(String p0, int p1) { return null; }
|
||||
@Override public Context getApplicationContext() { return null; }
|
||||
@Override public Drawable getWallpaper() { return null; }
|
||||
@Override public Drawable peekWallpaper() { return null; }
|
||||
@Override public File getCacheDir() { return null; }
|
||||
@Override public File getCodeCacheDir() { return null; }
|
||||
@Override public File getDataDir() { return null; }
|
||||
@Override public File getDatabasePath(String p0) { return null; }
|
||||
@Override public File getDir(String p0, int p1) { return null; }
|
||||
@Override public File getExternalCacheDir() { return null; }
|
||||
@Override public File getExternalFilesDir(String p0) { return null; }
|
||||
@Override public File getFileStreamPath(String p0) { return null; }
|
||||
@Override public File getFilesDir() { return null; }
|
||||
@Override public File getNoBackupFilesDir() { return null; }
|
||||
@Override public File getObbDir() { return null; }
|
||||
@Override public FileInputStream openFileInput(String p0) { return null; }
|
||||
@Override public FileOutputStream openFileOutput(String p0, int p1) { return null; }
|
||||
@Override public File[] getExternalCacheDirs() { return null; }
|
||||
@Override public File[] getExternalFilesDirs(String p0) { return null; }
|
||||
@Override public File[] getExternalMediaDirs() { return null; }
|
||||
@Override public File[] getObbDirs() { return null; }
|
||||
@Override public Intent registerReceiver(BroadcastReceiver p0, IntentFilter p1) { return null; }
|
||||
@Override public Intent registerReceiver(BroadcastReceiver p0, IntentFilter p1, String p2, Handler p3) { return null; }
|
||||
@Override public Intent registerReceiver(BroadcastReceiver p0, IntentFilter p1, String p2, Handler p3, int p4) { return null; }
|
||||
@Override public Intent registerReceiver(BroadcastReceiver p0, IntentFilter p1, int p2) { return null; }
|
||||
@Override public Looper getMainLooper() { return null; }
|
||||
@Override public Object getSystemService(String p0) { return null; }
|
||||
@Override public PackageManager getPackageManager() { return null; }
|
||||
@Override public Resources getResources() { return null; }
|
||||
@Override public Resources.Theme getTheme() { return null; }
|
||||
@Override public SQLiteDatabase openOrCreateDatabase(String p0, int p1, SQLiteDatabase.CursorFactory p2) { return null; }
|
||||
@Override public SQLiteDatabase openOrCreateDatabase(String p0, int p1, SQLiteDatabase.CursorFactory p2, DatabaseErrorHandler p3) { return null; }
|
||||
@Override public SharedPreferences getSharedPreferences(String p0, int p1) { return null; }
|
||||
@Override public String getPackageCodePath() { return null; }
|
||||
@Override public String getPackageName() { return null; }
|
||||
@Override public String getPackageResourcePath() { return null; }
|
||||
@Override public String getSystemServiceName(Class<? extends Object> p0) { return null; }
|
||||
@Override public String[] databaseList() { return null; }
|
||||
@Override public String[] fileList() { return null; }
|
||||
@Override public boolean bindService(Intent p0, ServiceConnection p1, int p2) { return false; }
|
||||
@Override public boolean deleteDatabase(String p0) { return false; }
|
||||
@Override public boolean deleteFile(String p0) { return false; }
|
||||
@Override public boolean deleteSharedPreferences(String p0) { return false; }
|
||||
@Override public boolean isDeviceProtectedStorage() { return false; }
|
||||
@Override public boolean moveDatabaseFrom(Context p0, String p1) { return false; }
|
||||
@Override public boolean moveSharedPreferencesFrom(Context p0, String p1) { return false; }
|
||||
@Override public boolean startInstrumentation(ComponentName p0, String p1, Bundle p2) { return false; }
|
||||
@Override public boolean stopService(Intent p0) { return false; }
|
||||
@Override public int checkCallingOrSelfPermission(String p0) { return 0; }
|
||||
@Override public int checkCallingOrSelfUriPermission(Uri p0, int p1) { return 0; }
|
||||
@Override public int checkCallingPermission(String p0) { return 0; }
|
||||
@Override public int checkCallingUriPermission(Uri p0, int p1) { return 0; }
|
||||
@Override public int checkPermission(String p0, int p1, int p2) { return 0; }
|
||||
@Override public int checkSelfPermission(String p0) { return 0; }
|
||||
@Override public int checkUriPermission(Uri p0, String p1, String p2, int p3, int p4, int p5) { return 0; }
|
||||
@Override public int checkUriPermission(Uri p0, int p1, int p2, int p3) { return 0; }
|
||||
@Override public int getWallpaperDesiredMinimumHeight() { return 0; }
|
||||
@Override public int getWallpaperDesiredMinimumWidth() { return 0; }
|
||||
@Override public void clearWallpaper() { }
|
||||
@Override public void enforceCallingOrSelfPermission(String p0, String p1) { }
|
||||
@Override public void enforceCallingOrSelfUriPermission(Uri p0, int p1, String p2) { }
|
||||
@Override public void enforceCallingPermission(String p0, String p1) { }
|
||||
@Override public void enforceCallingUriPermission(Uri p0, int p1, String p2) { }
|
||||
@Override public void enforcePermission(String p0, int p1, int p2, String p3) { }
|
||||
@Override public void enforceUriPermission(Uri p0, String p1, String p2, int p3, int p4, int p5, String p6) { }
|
||||
@Override public void enforceUriPermission(Uri p0, int p1, int p2, int p3, String p4) { }
|
||||
@Override public void grantUriPermission(String p0, Uri p1, int p2) { }
|
||||
@Override public void removeStickyBroadcast(Intent p0) { }
|
||||
@Override public void removeStickyBroadcastAsUser(Intent p0, UserHandle p1) { }
|
||||
@Override public void revokeUriPermission(String p0, Uri p1, int p2) { }
|
||||
@Override public void revokeUriPermission(Uri p0, int p1) { }
|
||||
@Override public void sendBroadcast(Intent p0) { }
|
||||
@Override public void sendBroadcast(Intent p0, String p1) { }
|
||||
@Override public void sendBroadcastAsUser(Intent p0, UserHandle p1) { }
|
||||
@Override public void sendBroadcastAsUser(Intent p0, UserHandle p1, String p2) { }
|
||||
// Slight cheat: this is an Android 11 function which shouldn't really be present in this Android 9 stub.
|
||||
@Override public void sendBroadcastWithMultiplePermissions(Intent p1, String[] p2) { }
|
||||
@Override public void sendOrderedBroadcast(Intent p0, String p1) { }
|
||||
@Override public void sendOrderedBroadcast(Intent p0, String p1, BroadcastReceiver p2, Handler p3, int p4, String p5, Bundle p6) { }
|
||||
@Override public void sendOrderedBroadcastAsUser(Intent p0, UserHandle p1, String p2, BroadcastReceiver p3, Handler p4, int p5, String p6, Bundle p7) { }
|
||||
@Override public void sendStickyBroadcast(Intent p0) { }
|
||||
@Override public void sendStickyBroadcastAsUser(Intent p0, UserHandle p1) { }
|
||||
@Override public void sendStickyOrderedBroadcast(Intent p0, BroadcastReceiver p1, Handler p2, int p3, String p4, Bundle p5) { }
|
||||
@Override public void sendStickyOrderedBroadcastAsUser(Intent p0, UserHandle p1, BroadcastReceiver p2, Handler p3, int p4, String p5, Bundle p6) { }
|
||||
@Override public void setTheme(int p0) { }
|
||||
@Override public void setWallpaper(Bitmap p0) { }
|
||||
@Override public void setWallpaper(InputStream p0) { }
|
||||
@Override public void startActivities(Intent[] p0) { }
|
||||
@Override public void startActivities(Intent[] p0, Bundle p1) { }
|
||||
@Override public void startActivity(Intent p0) { }
|
||||
@Override public void startActivity(Intent p0, Bundle p1) { }
|
||||
@Override public void startIntentSender(IntentSender p0, Intent p1, int p2, int p3, int p4) { }
|
||||
@Override public void startIntentSender(IntentSender p0, Intent p1, int p2, int p3, int p4, Bundle p5) { }
|
||||
@Override public void unbindService(ServiceConnection p0) { }
|
||||
@Override public void unregisterReceiver(BroadcastReceiver p0) { }
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,362 +1,38 @@
|
||||
/*
|
||||
* Copyright (C) 2006 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Generated automatically from android.content.SharedPreferences for testing purposes
|
||||
|
||||
package android.content;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
/**
|
||||
* Interface for accessing and modifying preference data returned by {@link
|
||||
* Context#getSharedPreferences}. For any particular set of preferences,
|
||||
* there is a single instance of this class that all clients share.
|
||||
* Modifications to the preferences must go through an {@link Editor} object
|
||||
* to ensure the preference values remain in a consistent state and control
|
||||
* when they are committed to storage. Objects that are returned from the
|
||||
* various <code>get</code> methods must be treated as immutable by the application.
|
||||
*
|
||||
* <p><em>Note: currently this class does not support use across multiple
|
||||
* processes. This will be added later.</em>
|
||||
*
|
||||
* <div class="special reference">
|
||||
* <h3>Developer Guides</h3>
|
||||
* <p>For more information about using SharedPreferences, read the
|
||||
* <a href="{@docRoot}guide/topics/data/data-storage.html#pref">Data Storage</a>
|
||||
* developer guide.</p></div>
|
||||
*
|
||||
* @see Context#getSharedPreferences
|
||||
*/
|
||||
public interface SharedPreferences {
|
||||
/**
|
||||
* Interface definition for a callback to be invoked when a shared
|
||||
* preference is changed.
|
||||
*/
|
||||
public interface OnSharedPreferenceChangeListener {
|
||||
/**
|
||||
* Called when a shared preference is changed, added, or removed. This
|
||||
* may be called even if a preference is set to its existing value.
|
||||
*
|
||||
* <p>This callback will be run on your main thread.
|
||||
*
|
||||
* @param sharedPreferences The {@link SharedPreferences} that received
|
||||
* the change.
|
||||
* @param key The key of the preference that was changed, added, or
|
||||
* removed.
|
||||
*/
|
||||
void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface used for modifying values in a {@link SharedPreferences}
|
||||
* object. All changes you make in an editor are batched, and not copied
|
||||
* back to the original {@link SharedPreferences} until you call {@link #commit}
|
||||
* or {@link #apply}
|
||||
*/
|
||||
public interface Editor {
|
||||
/**
|
||||
* Set a String value in the preferences editor, to be written back once
|
||||
* {@link #commit} or {@link #apply} are called.
|
||||
*
|
||||
* @param key The name of the preference to modify.
|
||||
* @param value The new value for the preference. Supplying {@code null}
|
||||
* as the value is equivalent to calling {@link #remove(String)} with
|
||||
* this key.
|
||||
*
|
||||
* @return Returns a reference to the same Editor object, so you can
|
||||
* chain put calls together.
|
||||
*/
|
||||
Editor putString(String key, String value);
|
||||
|
||||
/**
|
||||
* Set a set of String values in the preferences editor, to be written
|
||||
* back once {@link #commit} is called.
|
||||
*
|
||||
* @param key The name of the preference to modify.
|
||||
* @param values The set of new values for the preference. Passing {@code null}
|
||||
* for this argument is equivalent to calling {@link #remove(String)} with
|
||||
* this key.
|
||||
* @return Returns a reference to the same Editor object, so you can
|
||||
* chain put calls together.
|
||||
*/
|
||||
Editor putStringSet(String key, Set<String> values);
|
||||
|
||||
/**
|
||||
* Set an int value in the preferences editor, to be written back once
|
||||
* {@link #commit} or {@link #apply} are called.
|
||||
*
|
||||
* @param key The name of the preference to modify.
|
||||
* @param value The new value for the preference.
|
||||
*
|
||||
* @return Returns a reference to the same Editor object, so you can
|
||||
* chain put calls together.
|
||||
*/
|
||||
Editor putInt(String key, int value);
|
||||
|
||||
/**
|
||||
* Set a long value in the preferences editor, to be written back once
|
||||
* {@link #commit} or {@link #apply} are called.
|
||||
*
|
||||
* @param key The name of the preference to modify.
|
||||
* @param value The new value for the preference.
|
||||
*
|
||||
* @return Returns a reference to the same Editor object, so you can
|
||||
* chain put calls together.
|
||||
*/
|
||||
Editor putLong(String key, long value);
|
||||
|
||||
/**
|
||||
* Set a float value in the preferences editor, to be written back once
|
||||
* {@link #commit} or {@link #apply} are called.
|
||||
*
|
||||
* @param key The name of the preference to modify.
|
||||
* @param value The new value for the preference.
|
||||
*
|
||||
* @return Returns a reference to the same Editor object, so you can
|
||||
* chain put calls together.
|
||||
*/
|
||||
Editor putFloat(String key, float value);
|
||||
|
||||
/**
|
||||
* Set a boolean value in the preferences editor, to be written back
|
||||
* once {@link #commit} or {@link #apply} are called.
|
||||
*
|
||||
* @param key The name of the preference to modify.
|
||||
* @param value The new value for the preference.
|
||||
*
|
||||
* @return Returns a reference to the same Editor object, so you can
|
||||
* chain put calls together.
|
||||
*/
|
||||
Editor putBoolean(String key, boolean value);
|
||||
/**
|
||||
* Mark in the editor that a preference value should be removed, which
|
||||
* will be done in the actual preferences once {@link #commit} is
|
||||
* called.
|
||||
*
|
||||
* <p>Note that when committing back to the preferences, all removals
|
||||
* are done first, regardless of whether you called remove before
|
||||
* or after put methods on this editor.
|
||||
*
|
||||
* @param key The name of the preference to remove.
|
||||
*
|
||||
* @return Returns a reference to the same Editor object, so you can
|
||||
* chain put calls together.
|
||||
*/
|
||||
Editor remove(String key);
|
||||
/**
|
||||
* Mark in the editor to remove <em>all</em> values from the
|
||||
* preferences. Once commit is called, the only remaining preferences
|
||||
* will be any that you have defined in this editor.
|
||||
*
|
||||
* <p>Note that when committing back to the preferences, the clear
|
||||
* is done first, regardless of whether you called clear before
|
||||
* or after put methods on this editor.
|
||||
*
|
||||
* @return Returns a reference to the same Editor object, so you can
|
||||
* chain put calls together.
|
||||
*/
|
||||
Editor clear();
|
||||
/**
|
||||
* Commit your preferences changes back from this Editor to the
|
||||
* {@link SharedPreferences} object it is editing. This atomically
|
||||
* performs the requested modifications, replacing whatever is currently
|
||||
* in the SharedPreferences.
|
||||
*
|
||||
* <p>Note that when two editors are modifying preferences at the same
|
||||
* time, the last one to call commit wins.
|
||||
*
|
||||
* <p>If you don't care about the return value and you're
|
||||
* using this from your application's main thread, consider
|
||||
* using {@link #apply} instead.
|
||||
*
|
||||
* @return Returns true if the new values were successfully written
|
||||
* to persistent storage.
|
||||
*/
|
||||
|
||||
public interface SharedPreferences
|
||||
{
|
||||
Map<String, ? extends Object> getAll();
|
||||
Set<String> getStringSet(String p0, Set<String> p1);
|
||||
SharedPreferences.Editor edit();
|
||||
String getString(String p0, String p1);
|
||||
boolean contains(String p0);
|
||||
boolean getBoolean(String p0, boolean p1);
|
||||
float getFloat(String p0, float p1);
|
||||
int getInt(String p0, int p1);
|
||||
long getLong(String p0, long p1);
|
||||
static public interface Editor
|
||||
{
|
||||
SharedPreferences.Editor clear();
|
||||
SharedPreferences.Editor putBoolean(String p0, boolean p1);
|
||||
SharedPreferences.Editor putFloat(String p0, float p1);
|
||||
SharedPreferences.Editor putInt(String p0, int p1);
|
||||
SharedPreferences.Editor putLong(String p0, long p1);
|
||||
SharedPreferences.Editor putString(String p0, String p1);
|
||||
SharedPreferences.Editor putStringSet(String p0, Set<String> p1);
|
||||
SharedPreferences.Editor remove(String p0);
|
||||
boolean commit();
|
||||
/**
|
||||
* Commit your preferences changes back from this Editor to the
|
||||
* {@link SharedPreferences} object it is editing. This atomically
|
||||
* performs the requested modifications, replacing whatever is currently
|
||||
* in the SharedPreferences.
|
||||
*
|
||||
* <p>Note that when two editors are modifying preferences at the same
|
||||
* time, the last one to call apply wins.
|
||||
*
|
||||
* <p>Unlike {@link #commit}, which writes its preferences out
|
||||
* to persistent storage synchronously, {@link #apply}
|
||||
* commits its changes to the in-memory
|
||||
* {@link SharedPreferences} immediately but starts an
|
||||
* asynchronous commit to disk and you won't be notified of
|
||||
* any failures. If another editor on this
|
||||
* {@link SharedPreferences} does a regular {@link #commit}
|
||||
* while a {@link #apply} is still outstanding, the
|
||||
* {@link #commit} will block until all async commits are
|
||||
* completed as well as the commit itself.
|
||||
*
|
||||
* <p>As {@link SharedPreferences} instances are singletons within
|
||||
* a process, it's safe to replace any instance of {@link #commit} with
|
||||
* {@link #apply} if you were already ignoring the return value.
|
||||
*
|
||||
* <p>You don't need to worry about Android component
|
||||
* lifecycles and their interaction with <code>apply()</code>
|
||||
* writing to disk. The framework makes sure in-flight disk
|
||||
* writes from <code>apply()</code> complete before switching
|
||||
* states.
|
||||
*
|
||||
* <p class='note'>The SharedPreferences.Editor interface
|
||||
* isn't expected to be implemented directly. However, if you
|
||||
* previously did implement it and are now getting errors
|
||||
* about missing <code>apply()</code>, you can simply call
|
||||
* {@link #commit} from <code>apply()</code>.
|
||||
*/
|
||||
void apply();
|
||||
}
|
||||
/**
|
||||
* Retrieve all values from the preferences.
|
||||
*
|
||||
* <p>Note that you <em>must not</em> modify the collection returned
|
||||
* by this method, or alter any of its contents. The consistency of your
|
||||
* stored data is not guaranteed if you do.
|
||||
*
|
||||
* @return Returns a map containing a list of pairs key/value representing
|
||||
* the preferences.
|
||||
*
|
||||
* @throws NullPointerException
|
||||
*/
|
||||
Map<String, ?> getAll();
|
||||
/**
|
||||
* Retrieve a String value from the preferences.
|
||||
*
|
||||
* @param key The name of the preference to retrieve.
|
||||
* @param defValue Value to return if this preference does not exist.
|
||||
*
|
||||
* @return Returns the preference value if it exists, or defValue. Throws
|
||||
* ClassCastException if there is a preference with this name that is not
|
||||
* a String.
|
||||
*
|
||||
* @throws ClassCastException
|
||||
*/
|
||||
String getString(String key, String defValue);
|
||||
|
||||
/**
|
||||
* Retrieve a set of String values from the preferences.
|
||||
*
|
||||
* <p>Note that you <em>must not</em> modify the set instance returned
|
||||
* by this call. The consistency of the stored data is not guaranteed
|
||||
* if you do, nor is your ability to modify the instance at all.
|
||||
*
|
||||
* @param key The name of the preference to retrieve.
|
||||
* @param defValues Values to return if this preference does not exist.
|
||||
*
|
||||
* @return Returns the preference values if they exist, or defValues.
|
||||
* Throws ClassCastException if there is a preference with this name
|
||||
* that is not a Set.
|
||||
*
|
||||
* @throws ClassCastException
|
||||
*/
|
||||
Set<String> getStringSet(String key, Set<String> defValues);
|
||||
|
||||
/**
|
||||
* Retrieve an int value from the preferences.
|
||||
*
|
||||
* @param key The name of the preference to retrieve.
|
||||
* @param defValue Value to return if this preference does not exist.
|
||||
*
|
||||
* @return Returns the preference value if it exists, or defValue. Throws
|
||||
* ClassCastException if there is a preference with this name that is not
|
||||
* an int.
|
||||
*
|
||||
* @throws ClassCastException
|
||||
*/
|
||||
int getInt(String key, int defValue);
|
||||
|
||||
/**
|
||||
* Retrieve a long value from the preferences.
|
||||
*
|
||||
* @param key The name of the preference to retrieve.
|
||||
* @param defValue Value to return if this preference does not exist.
|
||||
*
|
||||
* @return Returns the preference value if it exists, or defValue. Throws
|
||||
* ClassCastException if there is a preference with this name that is not
|
||||
* a long.
|
||||
*
|
||||
* @throws ClassCastException
|
||||
*/
|
||||
long getLong(String key, long defValue);
|
||||
|
||||
/**
|
||||
* Retrieve a float value from the preferences.
|
||||
*
|
||||
* @param key The name of the preference to retrieve.
|
||||
* @param defValue Value to return if this preference does not exist.
|
||||
*
|
||||
* @return Returns the preference value if it exists, or defValue. Throws
|
||||
* ClassCastException if there is a preference with this name that is not
|
||||
* a float.
|
||||
*
|
||||
* @throws ClassCastException
|
||||
*/
|
||||
float getFloat(String key, float defValue);
|
||||
|
||||
/**
|
||||
* Retrieve a boolean value from the preferences.
|
||||
*
|
||||
* @param key The name of the preference to retrieve.
|
||||
* @param defValue Value to return if this preference does not exist.
|
||||
*
|
||||
* @return Returns the preference value if it exists, or defValue. Throws
|
||||
* ClassCastException if there is a preference with this name that is not
|
||||
* a boolean.
|
||||
*
|
||||
* @throws ClassCastException
|
||||
*/
|
||||
boolean getBoolean(String key, boolean defValue);
|
||||
/**
|
||||
* Checks whether the preferences contains a preference.
|
||||
*
|
||||
* @param key The name of the preference to check.
|
||||
* @return Returns true if the preference exists in the preferences,
|
||||
* otherwise false.
|
||||
*/
|
||||
boolean contains(String key);
|
||||
|
||||
/**
|
||||
* Create a new Editor for these preferences, through which you can make
|
||||
* modifications to the data in the preferences and atomically commit those
|
||||
* changes back to the SharedPreferences object.
|
||||
*
|
||||
* <p>Note that you <em>must</em> call {@link Editor#commit} to have any
|
||||
* changes you perform in the Editor actually show up in the
|
||||
* SharedPreferences.
|
||||
*
|
||||
* @return Returns a new instance of the {@link Editor} interface, allowing
|
||||
* you to modify the values in this SharedPreferences object.
|
||||
*/
|
||||
Editor edit();
|
||||
|
||||
/**
|
||||
* Registers a callback to be invoked when a change happens to a preference.
|
||||
*
|
||||
* @param listener The callback that will run.
|
||||
* @see #unregisterOnSharedPreferenceChangeListener
|
||||
*/
|
||||
void registerOnSharedPreferenceChangeListener(OnSharedPreferenceChangeListener listener);
|
||||
|
||||
/**
|
||||
* Unregisters a previous callback.
|
||||
*
|
||||
* @param listener The callback that should be unregistered.
|
||||
* @see #registerOnSharedPreferenceChangeListener
|
||||
*/
|
||||
void unregisterOnSharedPreferenceChangeListener(OnSharedPreferenceChangeListener listener);
|
||||
static public interface OnSharedPreferenceChangeListener
|
||||
{
|
||||
void onSharedPreferenceChanged(SharedPreferences p0, String p1);
|
||||
}
|
||||
void registerOnSharedPreferenceChangeListener(SharedPreferences.OnSharedPreferenceChangeListener p0);
|
||||
void unregisterOnSharedPreferenceChangeListener(SharedPreferences.OnSharedPreferenceChangeListener p0);
|
||||
}
|
||||
|
||||
132
java/ql/test/stubs/google-android-9.0.0/android/view/ContextThemeWrapper.java
generated
Normal file
132
java/ql/test/stubs/google-android-9.0.0/android/view/ContextThemeWrapper.java
generated
Normal file
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
* Copyright (C) 2006 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.view;
|
||||
|
||||
import android.annotation.StyleRes;
|
||||
import android.content.Context;
|
||||
import android.content.ContextWrapper;
|
||||
import android.content.res.AssetManager;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
|
||||
/**
|
||||
* A context wrapper that allows you to modify or replace the theme of the
|
||||
* wrapped context.
|
||||
*/
|
||||
public class ContextThemeWrapper extends ContextWrapper {
|
||||
/**
|
||||
* Creates a new context wrapper with no theme and no base context.
|
||||
* <p class="note">
|
||||
* <strong>Note:</strong> A base context <strong>must</strong> be attached
|
||||
* using {@link #attachBaseContext(Context)} before calling any other
|
||||
* method on the newly constructed context wrapper.
|
||||
*/
|
||||
public ContextThemeWrapper() {
|
||||
super(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new context wrapper with the specified theme.
|
||||
* <p>
|
||||
* The specified theme will be applied on top of the base context's theme.
|
||||
* Any attributes not explicitly defined in the theme identified by
|
||||
* <var>themeResId</var> will retain their original values.
|
||||
*
|
||||
* @param base the base context
|
||||
* @param themeResId the resource ID of the theme to be applied on top of
|
||||
* the base context's theme
|
||||
*/
|
||||
public ContextThemeWrapper(Context base, @StyleRes int themeResId) {
|
||||
super(base);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new context wrapper with the specified theme.
|
||||
* <p>
|
||||
* Unlike {@link #ContextThemeWrapper(Context, int)}, the theme passed to
|
||||
* this constructor will completely replace the base context's theme.
|
||||
*
|
||||
* @param base the base context
|
||||
* @param theme the theme against which resources should be inflated
|
||||
*/
|
||||
public ContextThemeWrapper(Context base, Resources.Theme theme) {
|
||||
super(base);
|
||||
}
|
||||
|
||||
/**
|
||||
* Call to set an "override configuration" on this context -- this is
|
||||
* a configuration that replies one or more values of the standard
|
||||
* configuration that is applied to the context. See
|
||||
* {@link Context#createConfigurationContext(Configuration)} for more
|
||||
* information.
|
||||
*
|
||||
* <p>This method can only be called once, and must be called before any
|
||||
* calls to {@link #getResources()} or {@link #getAssets()} are made.
|
||||
*/
|
||||
public void applyOverrideConfiguration(Configuration overrideConfiguration) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by ActivityThread to apply the overridden configuration to onConfigurationChange
|
||||
* callbacks.
|
||||
* @hide
|
||||
*/
|
||||
public Configuration getOverrideConfiguration() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AssetManager getAssets() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Resources getResources() {
|
||||
return null;
|
||||
}
|
||||
|
||||
private Resources getResourcesInternal() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTheme(int resid) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Resources.Theme getTheme() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getSystemService(String name) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by {@link #setTheme} and {@link #getTheme} to apply a theme
|
||||
* resource to the current Theme object. May be overridden to change the
|
||||
* default (simple) behavior. This method will not be called in multiple
|
||||
* threads simultaneously.
|
||||
*
|
||||
* @param theme the theme being modified
|
||||
* @param resId the style resource being applied to <var>theme</var>
|
||||
* @param first {@code true} if this is the first time a style is being
|
||||
* applied to <var>theme</var>
|
||||
*/
|
||||
protected void onApplyThemeResource(Resources.Theme theme, int resId, boolean first) {}
|
||||
}
|
||||
Reference in New Issue
Block a user