Merge "Zen: Update condition text for current condition." into lmp-mr1-dev
diff --git a/api/current.txt b/api/current.txt
index 746d31a..a76b24ed 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -2708,7 +2708,9 @@
method public void invalidateAuthToken(java.lang.String, java.lang.String);
method public static android.content.Intent newChooseAccountIntent(android.accounts.Account, java.util.ArrayList<android.accounts.Account>, java.lang.String[], boolean, java.lang.String, java.lang.String, java.lang.String[], android.os.Bundle);
method public java.lang.String peekAuthToken(android.accounts.Account, java.lang.String);
- method public android.accounts.AccountManagerFuture<java.lang.Boolean> removeAccount(android.accounts.Account, android.accounts.AccountManagerCallback<java.lang.Boolean>, android.os.Handler);
+ method public deprecated android.accounts.AccountManagerFuture<java.lang.Boolean> removeAccount(android.accounts.Account, android.accounts.AccountManagerCallback<java.lang.Boolean>, android.os.Handler);
+ method public android.accounts.AccountManagerFuture<android.os.Bundle> removeAccount(android.accounts.Account, android.app.Activity, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler);
+ method public boolean removeAccountExplicitly(android.accounts.Account);
method public void removeOnAccountsUpdatedListener(android.accounts.OnAccountsUpdateListener);
method public android.accounts.AccountManagerFuture<android.accounts.Account> renameAccount(android.accounts.Account, java.lang.String, android.accounts.AccountManagerCallback<android.accounts.Account>, android.os.Handler);
method public void setAuthToken(android.accounts.Account, java.lang.String, java.lang.String);
@@ -5393,6 +5395,7 @@
field public static final int ENCRYPTION_STATUS_UNSUPPORTED = 0; // 0x0
field public static final java.lang.String EXTRA_ADD_EXPLANATION = "android.app.extra.ADD_EXPLANATION";
field public static final java.lang.String EXTRA_DEVICE_ADMIN = "android.app.extra.DEVICE_ADMIN";
+ field public static final java.lang.String EXTRA_PROVISIONING_ACCOUNT_TO_MIGRATE = "android.app.extra.PROVISIONING_ACCOUNT_TO_MIGRATE";
field public static final java.lang.String EXTRA_PROVISIONING_ADMIN_EXTRAS_BUNDLE = "android.app.extra.PROVISIONING_ADMIN_EXTRAS_BUNDLE";
field public static final java.lang.String EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_CHECKSUM = "android.app.extra.PROVISIONING_DEVICE_ADMIN_PACKAGE_CHECKSUM";
field public static final java.lang.String EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_COOKIE_HEADER = "android.app.extra.PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_COOKIE_HEADER";
@@ -35923,24 +35926,25 @@
enum_constant public static final android.webkit.ConsoleMessage.MessageLevel WARNING;
}
- public class CookieManager {
- method public synchronized boolean acceptCookie();
- method public boolean acceptThirdPartyCookies(android.webkit.WebView);
+ public abstract class CookieManager {
+ ctor public CookieManager();
+ method public abstract boolean acceptCookie();
+ method public abstract boolean acceptThirdPartyCookies(android.webkit.WebView);
method public static boolean allowFileSchemeCookies();
- method public void flush();
- method public java.lang.String getCookie(java.lang.String);
+ method public abstract void flush();
+ method public abstract java.lang.String getCookie(java.lang.String);
method public static synchronized android.webkit.CookieManager getInstance();
- method public synchronized boolean hasCookies();
- method public deprecated void removeAllCookie();
- method public void removeAllCookies(android.webkit.ValueCallback<java.lang.Boolean>);
- method public deprecated void removeExpiredCookie();
- method public deprecated void removeSessionCookie();
- method public void removeSessionCookies(android.webkit.ValueCallback<java.lang.Boolean>);
- method public synchronized void setAcceptCookie(boolean);
+ method public abstract boolean hasCookies();
+ method public abstract deprecated void removeAllCookie();
+ method public abstract void removeAllCookies(android.webkit.ValueCallback<java.lang.Boolean>);
+ method public abstract deprecated void removeExpiredCookie();
+ method public abstract deprecated void removeSessionCookie();
+ method public abstract void removeSessionCookies(android.webkit.ValueCallback<java.lang.Boolean>);
+ method public abstract void setAcceptCookie(boolean);
method public static void setAcceptFileSchemeCookies(boolean);
- method public void setAcceptThirdPartyCookies(android.webkit.WebView, boolean);
- method public void setCookie(java.lang.String, java.lang.String);
- method public void setCookie(java.lang.String, java.lang.String, android.webkit.ValueCallback<java.lang.Boolean>);
+ method public abstract void setAcceptThirdPartyCookies(android.webkit.WebView, boolean);
+ method public abstract void setCookie(java.lang.String, java.lang.String);
+ method public abstract void setCookie(java.lang.String, java.lang.String, android.webkit.ValueCallback<java.lang.Boolean>);
}
public final deprecated class CookieSyncManager extends android.webkit.WebSyncManager {
@@ -36049,11 +36053,13 @@
method public abstract void onReceiveValue(T);
}
- public class WebBackForwardList implements java.lang.Cloneable java.io.Serializable {
- method public synchronized int getCurrentIndex();
- method public synchronized android.webkit.WebHistoryItem getCurrentItem();
- method public synchronized android.webkit.WebHistoryItem getItemAtIndex(int);
- method public synchronized int getSize();
+ public abstract class WebBackForwardList implements java.lang.Cloneable java.io.Serializable {
+ ctor public WebBackForwardList();
+ method protected abstract android.webkit.WebBackForwardList clone();
+ method public abstract int getCurrentIndex();
+ method public abstract android.webkit.WebHistoryItem getCurrentItem();
+ method public abstract android.webkit.WebHistoryItem getItemAtIndex(int);
+ method public abstract int getSize();
}
public class WebChromeClient {
@@ -36105,21 +36111,24 @@
field public static final int MODE_SAVE = 3; // 0x3
}
- public class WebHistoryItem implements java.lang.Cloneable {
- method public android.graphics.Bitmap getFavicon();
- method public java.lang.String getOriginalUrl();
- method public java.lang.String getTitle();
- method public java.lang.String getUrl();
+ public abstract class WebHistoryItem implements java.lang.Cloneable {
+ ctor public WebHistoryItem();
+ method protected abstract android.webkit.WebHistoryItem clone();
+ method public abstract android.graphics.Bitmap getFavicon();
+ method public abstract java.lang.String getOriginalUrl();
+ method public abstract java.lang.String getTitle();
+ method public abstract java.lang.String getUrl();
}
- public deprecated class WebIconDatabase {
- method public void close();
+ public abstract deprecated class WebIconDatabase {
+ ctor public WebIconDatabase();
+ method public abstract void close();
method public static android.webkit.WebIconDatabase getInstance();
- method public void open(java.lang.String);
- method public void releaseIconForPageUrl(java.lang.String);
- method public void removeAllIcons();
- method public void requestIconForPageUrl(java.lang.String, android.webkit.WebIconDatabase.IconListener);
- method public void retainIconForPageUrl(java.lang.String);
+ method public abstract void open(java.lang.String);
+ method public abstract void releaseIconForPageUrl(java.lang.String);
+ method public abstract void removeAllIcons();
+ method public abstract void requestIconForPageUrl(java.lang.String, android.webkit.WebIconDatabase.IconListener);
+ method public abstract void retainIconForPageUrl(java.lang.String);
}
public static abstract deprecated interface WebIconDatabase.IconListener {
@@ -36151,98 +36160,99 @@
}
public abstract class WebSettings {
- method public deprecated boolean enableSmoothTransition();
- method public boolean getAllowContentAccess();
- method public boolean getAllowFileAccess();
+ ctor public WebSettings();
+ method public abstract deprecated boolean enableSmoothTransition();
+ method public abstract boolean getAllowContentAccess();
+ method public abstract boolean getAllowFileAccess();
method public abstract boolean getAllowFileAccessFromFileURLs();
method public abstract boolean getAllowUniversalAccessFromFileURLs();
- method public synchronized boolean getBlockNetworkImage();
- method public synchronized boolean getBlockNetworkLoads();
- method public boolean getBuiltInZoomControls();
- method public int getCacheMode();
- method public synchronized java.lang.String getCursiveFontFamily();
- method public synchronized boolean getDatabaseEnabled();
- method public deprecated synchronized java.lang.String getDatabasePath();
- method public synchronized int getDefaultFixedFontSize();
- method public synchronized int getDefaultFontSize();
- method public synchronized java.lang.String getDefaultTextEncodingName();
+ method public abstract boolean getBlockNetworkImage();
+ method public abstract boolean getBlockNetworkLoads();
+ method public abstract boolean getBuiltInZoomControls();
+ method public abstract int getCacheMode();
+ method public abstract java.lang.String getCursiveFontFamily();
+ method public abstract boolean getDatabaseEnabled();
+ method public abstract deprecated java.lang.String getDatabasePath();
+ method public abstract int getDefaultFixedFontSize();
+ method public abstract int getDefaultFontSize();
+ method public abstract java.lang.String getDefaultTextEncodingName();
method public static java.lang.String getDefaultUserAgent(android.content.Context);
- method public deprecated android.webkit.WebSettings.ZoomDensity getDefaultZoom();
- method public boolean getDisplayZoomControls();
- method public synchronized boolean getDomStorageEnabled();
- method public synchronized java.lang.String getFantasyFontFamily();
- method public synchronized java.lang.String getFixedFontFamily();
- method public synchronized boolean getJavaScriptCanOpenWindowsAutomatically();
- method public synchronized boolean getJavaScriptEnabled();
- method public synchronized android.webkit.WebSettings.LayoutAlgorithm getLayoutAlgorithm();
- method public deprecated boolean getLightTouchEnabled();
- method public boolean getLoadWithOverviewMode();
- method public synchronized boolean getLoadsImagesAutomatically();
- method public boolean getMediaPlaybackRequiresUserGesture();
- method public synchronized int getMinimumFontSize();
- method public synchronized int getMinimumLogicalFontSize();
+ method public abstract deprecated android.webkit.WebSettings.ZoomDensity getDefaultZoom();
+ method public abstract boolean getDisplayZoomControls();
+ method public abstract boolean getDomStorageEnabled();
+ method public abstract java.lang.String getFantasyFontFamily();
+ method public abstract java.lang.String getFixedFontFamily();
+ method public abstract boolean getJavaScriptCanOpenWindowsAutomatically();
+ method public abstract boolean getJavaScriptEnabled();
+ method public abstract android.webkit.WebSettings.LayoutAlgorithm getLayoutAlgorithm();
+ method public abstract deprecated boolean getLightTouchEnabled();
+ method public abstract boolean getLoadWithOverviewMode();
+ method public abstract boolean getLoadsImagesAutomatically();
+ method public abstract boolean getMediaPlaybackRequiresUserGesture();
+ method public abstract int getMinimumFontSize();
+ method public abstract int getMinimumLogicalFontSize();
method public abstract int getMixedContentMode();
- method public deprecated synchronized android.webkit.WebSettings.PluginState getPluginState();
- method public synchronized java.lang.String getSansSerifFontFamily();
- method public boolean getSaveFormData();
- method public deprecated boolean getSavePassword();
- method public synchronized java.lang.String getSerifFontFamily();
- method public synchronized java.lang.String getStandardFontFamily();
+ method public abstract deprecated android.webkit.WebSettings.PluginState getPluginState();
+ method public abstract java.lang.String getSansSerifFontFamily();
+ method public abstract boolean getSaveFormData();
+ method public abstract deprecated boolean getSavePassword();
+ method public abstract java.lang.String getSerifFontFamily();
+ method public abstract java.lang.String getStandardFontFamily();
method public deprecated synchronized android.webkit.WebSettings.TextSize getTextSize();
- method public synchronized int getTextZoom();
- method public synchronized boolean getUseWideViewPort();
- method public synchronized java.lang.String getUserAgentString();
- method public void setAllowContentAccess(boolean);
- method public void setAllowFileAccess(boolean);
+ method public abstract int getTextZoom();
+ method public abstract boolean getUseWideViewPort();
+ method public abstract java.lang.String getUserAgentString();
+ method public abstract void setAllowContentAccess(boolean);
+ method public abstract void setAllowFileAccess(boolean);
method public abstract void setAllowFileAccessFromFileURLs(boolean);
method public abstract void setAllowUniversalAccessFromFileURLs(boolean);
- method public synchronized void setAppCacheEnabled(boolean);
- method public deprecated synchronized void setAppCacheMaxSize(long);
- method public synchronized void setAppCachePath(java.lang.String);
- method public synchronized void setBlockNetworkImage(boolean);
- method public synchronized void setBlockNetworkLoads(boolean);
- method public void setBuiltInZoomControls(boolean);
- method public void setCacheMode(int);
- method public synchronized void setCursiveFontFamily(java.lang.String);
- method public synchronized void setDatabaseEnabled(boolean);
- method public deprecated synchronized void setDatabasePath(java.lang.String);
- method public synchronized void setDefaultFixedFontSize(int);
- method public synchronized void setDefaultFontSize(int);
- method public synchronized void setDefaultTextEncodingName(java.lang.String);
- method public deprecated void setDefaultZoom(android.webkit.WebSettings.ZoomDensity);
- method public void setDisplayZoomControls(boolean);
- method public synchronized void setDomStorageEnabled(boolean);
- method public deprecated void setEnableSmoothTransition(boolean);
- method public synchronized void setFantasyFontFamily(java.lang.String);
- method public synchronized void setFixedFontFamily(java.lang.String);
- method public synchronized void setGeolocationDatabasePath(java.lang.String);
- method public synchronized void setGeolocationEnabled(boolean);
- method public synchronized void setJavaScriptCanOpenWindowsAutomatically(boolean);
- method public synchronized void setJavaScriptEnabled(boolean);
- method public synchronized void setLayoutAlgorithm(android.webkit.WebSettings.LayoutAlgorithm);
- method public deprecated void setLightTouchEnabled(boolean);
- method public void setLoadWithOverviewMode(boolean);
- method public synchronized void setLoadsImagesAutomatically(boolean);
- method public void setMediaPlaybackRequiresUserGesture(boolean);
- method public synchronized void setMinimumFontSize(int);
- method public synchronized void setMinimumLogicalFontSize(int);
+ method public abstract void setAppCacheEnabled(boolean);
+ method public abstract deprecated void setAppCacheMaxSize(long);
+ method public abstract void setAppCachePath(java.lang.String);
+ method public abstract void setBlockNetworkImage(boolean);
+ method public abstract void setBlockNetworkLoads(boolean);
+ method public abstract void setBuiltInZoomControls(boolean);
+ method public abstract void setCacheMode(int);
+ method public abstract void setCursiveFontFamily(java.lang.String);
+ method public abstract void setDatabaseEnabled(boolean);
+ method public abstract deprecated void setDatabasePath(java.lang.String);
+ method public abstract void setDefaultFixedFontSize(int);
+ method public abstract void setDefaultFontSize(int);
+ method public abstract void setDefaultTextEncodingName(java.lang.String);
+ method public abstract deprecated void setDefaultZoom(android.webkit.WebSettings.ZoomDensity);
+ method public abstract void setDisplayZoomControls(boolean);
+ method public abstract void setDomStorageEnabled(boolean);
+ method public abstract deprecated void setEnableSmoothTransition(boolean);
+ method public abstract void setFantasyFontFamily(java.lang.String);
+ method public abstract void setFixedFontFamily(java.lang.String);
+ method public abstract void setGeolocationDatabasePath(java.lang.String);
+ method public abstract void setGeolocationEnabled(boolean);
+ method public abstract void setJavaScriptCanOpenWindowsAutomatically(boolean);
+ method public abstract void setJavaScriptEnabled(boolean);
+ method public abstract void setLayoutAlgorithm(android.webkit.WebSettings.LayoutAlgorithm);
+ method public abstract deprecated void setLightTouchEnabled(boolean);
+ method public abstract void setLoadWithOverviewMode(boolean);
+ method public abstract void setLoadsImagesAutomatically(boolean);
+ method public abstract void setMediaPlaybackRequiresUserGesture(boolean);
+ method public abstract void setMinimumFontSize(int);
+ method public abstract void setMinimumLogicalFontSize(int);
method public abstract void setMixedContentMode(int);
- method public void setNeedInitialFocus(boolean);
- method public deprecated synchronized void setPluginState(android.webkit.WebSettings.PluginState);
- method public deprecated synchronized void setRenderPriority(android.webkit.WebSettings.RenderPriority);
- method public synchronized void setSansSerifFontFamily(java.lang.String);
- method public void setSaveFormData(boolean);
- method public deprecated void setSavePassword(boolean);
- method public synchronized void setSerifFontFamily(java.lang.String);
- method public synchronized void setStandardFontFamily(java.lang.String);
- method public synchronized void setSupportMultipleWindows(boolean);
- method public void setSupportZoom(boolean);
+ method public abstract void setNeedInitialFocus(boolean);
+ method public abstract deprecated void setPluginState(android.webkit.WebSettings.PluginState);
+ method public abstract deprecated void setRenderPriority(android.webkit.WebSettings.RenderPriority);
+ method public abstract void setSansSerifFontFamily(java.lang.String);
+ method public abstract void setSaveFormData(boolean);
+ method public abstract deprecated void setSavePassword(boolean);
+ method public abstract void setSerifFontFamily(java.lang.String);
+ method public abstract void setStandardFontFamily(java.lang.String);
+ method public abstract void setSupportMultipleWindows(boolean);
+ method public abstract void setSupportZoom(boolean);
method public deprecated synchronized void setTextSize(android.webkit.WebSettings.TextSize);
- method public synchronized void setTextZoom(int);
- method public synchronized void setUseWideViewPort(boolean);
- method public synchronized void setUserAgentString(java.lang.String);
- method public synchronized boolean supportMultipleWindows();
- method public boolean supportZoom();
+ method public abstract void setTextZoom(int);
+ method public abstract void setUseWideViewPort(boolean);
+ method public abstract void setUserAgentString(java.lang.String);
+ method public abstract boolean supportMultipleWindows();
+ method public abstract boolean supportZoom();
field public static final int LOAD_CACHE_ELSE_NETWORK = 1; // 0x1
field public static final int LOAD_CACHE_ONLY = 3; // 0x3
field public static final int LOAD_DEFAULT = -1; // 0xffffffff
@@ -36492,14 +36502,15 @@
field public static final int ERROR_UNSUPPORTED_SCHEME = -10; // 0xfffffff6
}
- public class WebViewDatabase {
- method public void clearFormData();
- method public void clearHttpAuthUsernamePassword();
- method public deprecated void clearUsernamePassword();
+ public abstract class WebViewDatabase {
+ ctor public WebViewDatabase();
+ method public abstract void clearFormData();
+ method public abstract void clearHttpAuthUsernamePassword();
+ method public abstract deprecated void clearUsernamePassword();
method public static android.webkit.WebViewDatabase getInstance(android.content.Context);
- method public boolean hasFormData();
- method public boolean hasHttpAuthUsernamePassword();
- method public deprecated boolean hasUsernamePassword();
+ method public abstract boolean hasFormData();
+ method public abstract boolean hasHttpAuthUsernamePassword();
+ method public abstract deprecated boolean hasUsernamePassword();
}
public class WebViewFragment extends android.app.Fragment {
diff --git a/core/java/android/accounts/AccountManager.java b/core/java/android/accounts/AccountManager.java
index 09b484b..64c2fd0 100644
--- a/core/java/android/accounts/AccountManager.java
+++ b/core/java/android/accounts/AccountManager.java
@@ -17,37 +17,37 @@
package android.accounts;
import android.app.Activity;
-import android.content.Intent;
+import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
+import android.content.Intent;
import android.content.IntentFilter;
-import android.content.BroadcastReceiver;
import android.content.res.Resources;
import android.database.SQLException;
+import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
-import android.os.RemoteException;
import android.os.Parcelable;
-import android.os.Build;
import android.os.Process;
+import android.os.RemoteException;
import android.os.UserHandle;
-import android.util.Log;
import android.text.TextUtils;
+import android.util.Log;
+
+import com.android.internal.R;
+import com.google.android.collect.Maps;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
import java.util.concurrent.Callable;
import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;
-import java.util.concurrent.TimeoutException;
import java.util.concurrent.TimeUnit;
-import java.util.HashMap;
-import java.util.Map;
-
-import com.android.internal.R;
-import com.google.android.collect.Maps;
+import java.util.concurrent.TimeoutException;
/**
* This class provides access to a centralized registry of the user's
@@ -747,13 +747,17 @@
* null for the main thread
* @return An {@link AccountManagerFuture} which resolves to a Boolean,
* true if the account has been successfully removed
+ * @deprecated use
+ * {@link #removeAccount(Account, Activity, AccountManagerCallback, Handler)}
+ * instead
*/
+ @Deprecated
public AccountManagerFuture<Boolean> removeAccount(final Account account,
AccountManagerCallback<Boolean> callback, Handler handler) {
if (account == null) throw new IllegalArgumentException("account is null");
return new Future2Task<Boolean>(handler, callback) {
public void doWork() throws RemoteException {
- mService.removeAccount(mResponse, account);
+ mService.removeAccount(mResponse, account, false);
}
public Boolean bundleToResult(Bundle bundle) throws AuthenticatorException {
if (!bundle.containsKey(KEY_BOOLEAN_RESULT)) {
@@ -765,9 +769,60 @@
}
/**
+ * Removes an account from the AccountManager. Does nothing if the account
+ * does not exist. Does not delete the account from the server.
+ * The authenticator may have its own policies preventing account
+ * deletion, in which case the account will not be deleted.
+ *
+ * <p>This method may be called from any thread, but the returned
+ * {@link AccountManagerFuture} must not be used on the main thread.
+ *
+ * <p>This method requires the caller to hold the permission
+ * {@link android.Manifest.permission#MANAGE_ACCOUNTS}.
+ *
+ * @param account The {@link Account} to remove
+ * @param activity The {@link Activity} context to use for launching a new
+ * authenticator-defined sub-Activity to prompt the user to delete an
+ * account; used only to call startActivity(); if null, the prompt
+ * will not be launched directly, but the {@link Intent} may be
+ * returned to the caller instead
+ * @param callback Callback to invoke when the request completes,
+ * null for no callback
+ * @param handler {@link Handler} identifying the callback thread,
+ * null for the main thread
+ * @return An {@link AccountManagerFuture} which resolves to a Bundle with
+ * {@link #KEY_BOOLEAN_RESULT} if activity was specified and an account
+ * was removed or if active. If no activity was specified, the returned
+ * Bundle contains only {@link #KEY_INTENT} with the {@link Intent}
+ * needed to launch the actual account removal process, if authenticator
+ * needs the activity launch. If an error occurred,
+ * {@link AccountManagerFuture#getResult()} throws:
+ * <ul>
+ * <li> {@link AuthenticatorException} if no authenticator was registered for
+ * this account type or the authenticator failed to respond
+ * <li> {@link OperationCanceledException} if the operation was canceled for
+ * any reason, including the user canceling the creation process or
+ * adding accounts (of this type) has been disabled by policy
+ * </ul>
+ */
+ public AccountManagerFuture<Bundle> removeAccount(final Account account,
+ final Activity activity, AccountManagerCallback<Bundle> callback, Handler handler) {
+ if (account == null) throw new IllegalArgumentException("account is null");
+ return new AmsTask(activity, handler, callback) {
+ public void doWork() throws RemoteException {
+ mService.removeAccount(mResponse, account, activity != null);
+ }
+ }.start();
+ }
+
+ /**
* @see #removeAccount(Account, AccountManagerCallback, Handler)
* @hide
+ * @deprecated use
+ * {@link #removeAccountAsUser(Account, Activity, AccountManagerCallback, Handler)}
+ * instead
*/
+ @Deprecated
public AccountManagerFuture<Boolean> removeAccountAsUser(final Account account,
AccountManagerCallback<Boolean> callback, Handler handler,
final UserHandle userHandle) {
@@ -775,7 +830,7 @@
if (userHandle == null) throw new IllegalArgumentException("userHandle is null");
return new Future2Task<Boolean>(handler, callback) {
public void doWork() throws RemoteException {
- mService.removeAccountAsUser(mResponse, account, userHandle.getIdentifier());
+ mService.removeAccountAsUser(mResponse, account, false, userHandle.getIdentifier());
}
public Boolean bundleToResult(Bundle bundle) throws AuthenticatorException {
if (!bundle.containsKey(KEY_BOOLEAN_RESULT)) {
@@ -787,6 +842,52 @@
}
/**
+ * @see #removeAccount(Account, Activity, AccountManagerCallback, Handler)
+ * @hide
+ */
+ public AccountManagerFuture<Bundle> removeAccountAsUser(final Account account,
+ final Activity activity, AccountManagerCallback<Bundle> callback, Handler handler,
+ final UserHandle userHandle) {
+ if (account == null)
+ throw new IllegalArgumentException("account is null");
+ if (userHandle == null)
+ throw new IllegalArgumentException("userHandle is null");
+ return new AmsTask(activity, handler, callback) {
+ public void doWork() throws RemoteException {
+ mService.removeAccountAsUser(mResponse, account, activity != null,
+ userHandle.getIdentifier());
+ }
+ }.start();
+ }
+
+ /**
+ * Removes an account directly. Normally used by authenticators, not
+ * directly by applications. Does not delete the account from the server.
+ * The authenticator may have its own policies preventing account deletion,
+ * in which case the account will not be deleted.
+ * <p>
+ * It is safe to call this method from the main thread.
+ * <p>
+ * This method requires the caller to hold the permission
+ * {@link android.Manifest.permission#AUTHENTICATE_ACCOUNTS} and to have the
+ * same UID or signature as the account's authenticator.
+ *
+ * @param account The {@link Account} to delete.
+ * @return True if the account was successfully deleted, false if the
+ * account did not exist, the account is null, or another error
+ * occurs.
+ */
+ public boolean removeAccountExplicitly(Account account) {
+ if (account == null) throw new IllegalArgumentException("account is null");
+ try {
+ return mService.removeAccountExplicitly(account);
+ } catch (RemoteException e) {
+ // won't ever happen
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
* Removes an auth token from the AccountManager's cache. Does nothing if
* the auth token is not currently in the cache. Applications must call this
* method when the auth token is found to have expired or otherwise become
diff --git a/core/java/android/accounts/IAccountManager.aidl b/core/java/android/accounts/IAccountManager.aidl
index a133788..bc75b9b 100644
--- a/core/java/android/accounts/IAccountManager.aidl
+++ b/core/java/android/accounts/IAccountManager.aidl
@@ -37,8 +37,11 @@
void hasFeatures(in IAccountManagerResponse response, in Account account, in String[] features);
void getAccountsByFeatures(in IAccountManagerResponse response, String accountType, in String[] features);
boolean addAccountExplicitly(in Account account, String password, in Bundle extras);
- void removeAccount(in IAccountManagerResponse response, in Account account);
- void removeAccountAsUser(in IAccountManagerResponse response, in Account account, int userId);
+ void removeAccount(in IAccountManagerResponse response, in Account account,
+ boolean expectActivityLaunch);
+ void removeAccountAsUser(in IAccountManagerResponse response, in Account account,
+ boolean expectActivityLaunch, int userId);
+ boolean removeAccountExplicitly(in Account account);
void invalidateAuthToken(String accountType, String authToken);
String peekAuthToken(in Account account, String authTokenType);
void setAuthToken(in Account account, String authTokenType, String authToken);
diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java
index 33cac75..756e51f 100644
--- a/core/java/android/app/admin/DevicePolicyManager.java
+++ b/core/java/android/app/admin/DevicePolicyManager.java
@@ -149,6 +149,17 @@
= "android.app.extra.PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME";
/**
+ * An {@link android.accounts.Account} extra holding the account to migrate during managed
+ * profile provisioning. If the account supplied is present in the primary user, it will be
+ * copied, along with its credentials to the managed profile and removed from the primary user.
+ *
+ * Use with {@link #ACTION_PROVISION_MANAGED_PROFILE}.
+ */
+
+ public static final String EXTRA_PROVISIONING_ACCOUNT_TO_MIGRATE
+ = "android.app.extra.PROVISIONING_ACCOUNT_TO_MIGRATE";
+
+ /**
* A String extra that, holds the email address of the account which a managed profile is
* created for. Used with {@link #ACTION_PROVISION_MANAGED_PROFILE} and
* {@link DeviceAdminReceiver#ACTION_PROFILE_PROVISIONING_COMPLETE}.
diff --git a/core/java/android/net/WebAddress.java b/core/java/android/net/WebAddress.java
index 8126b75..24d4eb8 100644
--- a/core/java/android/net/WebAddress.java
+++ b/core/java/android/net/WebAddress.java
@@ -18,6 +18,8 @@
import static android.util.Patterns.GOOD_IRI_CHAR;
+import android.annotation.SystemApi;
+
import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -38,6 +40,9 @@
* If given an https scheme but no port, fills in port
*
*/
+// TODO(igsolla): remove WebAddress from the system SDK once the WebView apk does not
+// longer need to be binary compatible with the API 21 version of the framework.
+@SystemApi
public class WebAddress {
private String mScheme;
@@ -136,42 +141,52 @@
return mScheme + "://" + authInfo + mHost + port + mPath;
}
+ /** {@hide} */
public void setScheme(String scheme) {
mScheme = scheme;
}
+ /** {@hide} */
public String getScheme() {
return mScheme;
}
+ /** {@hide} */
public void setHost(String host) {
mHost = host;
}
+ /** {@hide} */
public String getHost() {
return mHost;
}
+ /** {@hide} */
public void setPort(int port) {
mPort = port;
}
+ /** {@hide} */
public int getPort() {
return mPort;
}
+ /** {@hide} */
public void setPath(String path) {
mPath = path;
}
+ /** {@hide} */
public String getPath() {
return mPath;
}
+ /** {@hide} */
public void setAuthInfo(String authInfo) {
mAuthInfo = authInfo;
}
+ /** {@hide} */
public String getAuthInfo() {
return mAuthInfo;
}
diff --git a/core/java/android/view/InputEvent.java b/core/java/android/view/InputEvent.java
index 1ecdf30..e2ad3ad 100644
--- a/core/java/android/view/InputEvent.java
+++ b/core/java/android/view/InputEvent.java
@@ -196,6 +196,13 @@
public abstract long getEventTimeNano();
/**
+ * Marks the input event as being canceled.
+ *
+ * @hide
+ */
+ public abstract void cancel();
+
+ /**
* Gets the unique sequence number of this event.
* Every input event that is created or received by a process has a
* unique sequence number. Moreover, a new sequence number is obtained
diff --git a/core/java/android/view/KeyEvent.java b/core/java/android/view/KeyEvent.java
index 0701b53..243a0fc 100644
--- a/core/java/android/view/KeyEvent.java
+++ b/core/java/android/view/KeyEvent.java
@@ -2304,6 +2304,16 @@
}
/**
+ * Set {@link #FLAG_CANCELED} flag for the key event.
+ *
+ * @hide
+ */
+ @Override
+ public final void cancel() {
+ mFlags |= FLAG_CANCELED;
+ }
+
+ /**
* Call this during {@link Callback#onKeyDown} to have the system track
* the key through its final up (possibly including a long press). Note
* that only one key can be tracked at a time -- if another key down
diff --git a/core/java/android/view/MotionEvent.java b/core/java/android/view/MotionEvent.java
index ae39b7a..1c5c41c 100644
--- a/core/java/android/view/MotionEvent.java
+++ b/core/java/android/view/MotionEvent.java
@@ -3168,6 +3168,12 @@
return ev;
}
+ /** @hide */
+ @Override
+ public final void cancel() {
+ setAction(ACTION_CANCEL);
+ }
+
public void writeToParcel(Parcel out, int flags) {
out.writeInt(PARCEL_TOKEN_MOTION_EVENT);
nativeWriteToParcel(mNativePtr, out);
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 9c378cf..5fc37c0 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -13174,7 +13174,7 @@
}
// Should resolve Drawables before Padding because we need the layout direction of the
// Drawable to correctly resolve Padding.
- if (!isDrawablesResolved()) {
+ if (!areDrawablesResolved()) {
resolveDrawables();
}
if (!isPaddingResolved()) {
@@ -13438,6 +13438,14 @@
* @hide
*/
public void resetResolvedPadding() {
+ resetResolvedPaddingInternal();
+ }
+
+ /**
+ * Used when we only want to reset *this* view's padding and not trigger overrides
+ * in ViewGroup that reset children too.
+ */
+ void resetResolvedPaddingInternal() {
mPrivateFlags2 &= ~PFLAG2_PADDING_RESOLVED;
}
@@ -15974,6 +15982,10 @@
onResolveDrawables(layoutDirection);
}
+ boolean areDrawablesResolved() {
+ return (mPrivateFlags2 & PFLAG2_DRAWABLE_RESOLVED) == PFLAG2_DRAWABLE_RESOLVED;
+ }
+
/**
* Called when layout direction has been resolved.
*
@@ -15993,11 +16005,11 @@
* @hide
*/
protected void resetResolvedDrawables() {
- mPrivateFlags2 &= ~PFLAG2_DRAWABLE_RESOLVED;
+ resetResolvedDrawablesInternal();
}
- private boolean isDrawablesResolved() {
- return (mPrivateFlags2 & PFLAG2_DRAWABLE_RESOLVED) == PFLAG2_DRAWABLE_RESOLVED;
+ void resetResolvedDrawablesInternal() {
+ mPrivateFlags2 &= ~PFLAG2_DRAWABLE_RESOLVED;
}
/**
@@ -16297,10 +16309,10 @@
padding = new Rect();
sThreadLocal.set(padding);
}
- resetResolvedDrawables();
+ resetResolvedDrawablesInternal();
background.setLayoutDirection(getLayoutDirection());
if (background.getPadding(padding)) {
- resetResolvedPadding();
+ resetResolvedPaddingInternal();
switch (background.getLayoutDirection()) {
case LAYOUT_DIRECTION_RTL:
mUserPaddingLeftInitial = padding.right;
@@ -16500,7 +16512,7 @@
* @param bottom the bottom padding in pixels
*/
public void setPadding(int left, int top, int right, int bottom) {
- resetResolvedPadding();
+ resetResolvedPaddingInternal();
mUserPaddingStart = UNDEFINED_PADDING;
mUserPaddingEnd = UNDEFINED_PADDING;
@@ -16592,7 +16604,7 @@
* @param bottom the bottom padding in pixels
*/
public void setPaddingRelative(int start, int top, int end, int bottom) {
- resetResolvedPadding();
+ resetResolvedPaddingInternal();
mUserPaddingStart = start;
mUserPaddingEnd = end;
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index b47ca37..bae0b12 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -6150,7 +6150,7 @@
int count = getChildCount();
for (int i = 0; i < count; i++) {
final View child = getChildAt(i);
- if (child.isLayoutDirectionInherited()) {
+ if (child.isLayoutDirectionInherited() && !child.isPaddingResolved()) {
child.resolvePadding();
}
}
@@ -6165,7 +6165,7 @@
int count = getChildCount();
for (int i = 0; i < count; i++) {
final View child = getChildAt(i);
- if (child.isLayoutDirectionInherited()) {
+ if (child.isLayoutDirectionInherited() && !child.areDrawablesResolved()) {
child.resolveDrawables();
}
}
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 5d2a24b..fe17417 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -3596,12 +3596,19 @@
if (mView == null || !mAdded) {
Slog.w(TAG, "Dropping event due to root view being removed: " + q.mEvent);
return true;
- } else if (!mAttachInfo.mHasWindowFocus &&
- !q.mEvent.isFromSource(InputDevice.SOURCE_CLASS_POINTER) &&
- !isTerminalInputEvent(q.mEvent)) {
- // If this is a focused event and the window doesn't currently have input focus,
- // then drop this event. This could be an event that came back from the previous
- // stage but the window has lost focus in the meantime.
+ } else if ((!mAttachInfo.mHasWindowFocus || mStopped)
+ && !q.mEvent.isFromSource(InputDevice.SOURCE_CLASS_POINTER)) {
+ // This is a focus event and the window doesn't currently have input focus or
+ // has stopped. This could be an event that came back from the previous stage
+ // but the window has lost focus or stopped in the meantime.
+ if (isTerminalInputEvent(q.mEvent)) {
+ // Don't drop terminal input events, however mark them as canceled.
+ q.mEvent.cancel();
+ Slog.w(TAG, "Cancelling event due to no window focus: " + q.mEvent);
+ return false;
+ }
+
+ // Drop non-terminal input events.
Slog.w(TAG, "Dropping event due to no window focus: " + q.mEvent);
return true;
}
diff --git a/core/java/android/webkit/CookieManager.java b/core/java/android/webkit/CookieManager.java
index 20ef646..eca96f9 100644
--- a/core/java/android/webkit/CookieManager.java
+++ b/core/java/android/webkit/CookieManager.java
@@ -16,18 +16,14 @@
package android.webkit;
+import android.annotation.SystemApi;
import android.net.WebAddress;
/**
* Manages the cookies used by an application's {@link WebView} instances.
* Cookies are manipulated according to RFC2109.
*/
-public class CookieManager {
- /**
- * @hide Only for use by WebViewProvider implementations
- */
- protected CookieManager() {
- }
+public abstract class CookieManager {
@Override
protected Object clone() throws CloneNotSupportedException {
@@ -59,9 +55,7 @@
* @param accept whether {@link WebView} instances should send and accept
* cookies
*/
- public synchronized void setAcceptCookie(boolean accept) {
- throw new MustOverrideException();
- }
+ public abstract void setAcceptCookie(boolean accept);
/**
* Gets whether the application's {@link WebView} instances send and accept
@@ -69,9 +63,7 @@
*
* @return true if {@link WebView} instances send and accept cookies
*/
- public synchronized boolean acceptCookie() {
- throw new MustOverrideException();
- }
+ public abstract boolean acceptCookie();
/**
* Sets whether the {@link WebView} should allow third party cookies to be set.
@@ -87,9 +79,7 @@
* @param accept whether the {@link WebView} instance should accept
* third party cookies
*/
- public void setAcceptThirdPartyCookies(WebView webview, boolean accept) {
- throw new MustOverrideException();
- }
+ public abstract void setAcceptThirdPartyCookies(WebView webview, boolean accept);
/**
* Gets whether the {@link WebView} should allow third party cookies to be set.
@@ -97,9 +87,7 @@
* @param webview the {@link WebView} instance to get the cookie policy for
* @return true if the {@link WebView} accepts third party cookies
*/
- public boolean acceptThirdPartyCookies(WebView webview) {
- throw new MustOverrideException();
- }
+ public abstract boolean acceptThirdPartyCookies(WebView webview);
/**
* Sets a cookie for the given URL. Any existing cookie with the same host,
@@ -110,9 +98,7 @@
* @param value the cookie as a string, using the format of the 'Set-Cookie'
* HTTP response header
*/
- public void setCookie(String url, String value) {
- throw new MustOverrideException();
- }
+ public abstract void setCookie(String url, String value);
/**
* Sets a cookie for the given URL. Any existing cookie with the same host,
@@ -133,9 +119,7 @@
* HTTP response header
* @param callback a callback to be executed when the cookie has been set
*/
- public void setCookie(String url, String value, ValueCallback<Boolean> callback) {
- throw new MustOverrideException();
- }
+ public abstract void setCookie(String url, String value, ValueCallback<Boolean> callback);
/**
* Gets the cookies for the given URL.
@@ -144,9 +128,7 @@
* @return value the cookies as a string, using the format of the 'Cookie'
* HTTP request header
*/
- public String getCookie(String url) {
- throw new MustOverrideException();
- }
+ public abstract String getCookie(String url);
/**
* See {@link #getCookie(String)}.
@@ -155,11 +137,10 @@
* @param privateBrowsing whether to use the private browsing cookie jar
* @return value the cookies as a string, using the format of the 'Cookie'
* HTTP request header
- * @hide Used by Browser, no intention to publish.
+ * @hide Used by Browser and by WebViewProvider implementations.
*/
- public String getCookie(String url, boolean privateBrowsing) {
- throw new MustOverrideException();
- }
+ @SystemApi
+ public abstract String getCookie(String url, boolean privateBrowsing);
/**
* Gets cookie(s) for a given uri so that it can be set to "cookie:" in http
@@ -168,10 +149,11 @@
* @param uri the WebAddress for which the cookies are requested
* @return value the cookies as a string, using the format of the 'Cookie'
* HTTP request header
- * @hide Used by RequestHandle, no intention to publish.
+ * @hide Used by RequestHandle and by WebViewProvider implementations.
*/
+ @SystemApi
public synchronized String getCookie(WebAddress uri) {
- throw new MustOverrideException();
+ return getCookie(uri.toString());
}
/**
@@ -179,9 +161,7 @@
* date.
* @deprecated use {@link #removeSessionCookies(ValueCallback)} instead.
*/
- public void removeSessionCookie() {
- throw new MustOverrideException();
- }
+ public abstract void removeSessionCookie();
/**
* Removes all session cookies, which are cookies without an expiration
@@ -197,18 +177,14 @@
* method from a thread without a Looper.
* @param callback a callback which is executed when the session cookies have been removed
*/
- public void removeSessionCookies(ValueCallback<Boolean> callback) {
- throw new MustOverrideException();
- }
+ public abstract void removeSessionCookies(ValueCallback<Boolean> callback);
/**
* Removes all cookies.
* @deprecated Use {@link #removeAllCookies(ValueCallback)} instead.
*/
@Deprecated
- public void removeAllCookie() {
- throw new MustOverrideException();
- }
+ public abstract void removeAllCookie();
/**
* Removes all cookies.
@@ -223,54 +199,37 @@
* method from a thread without a Looper.
* @param callback a callback which is executed when the cookies have been removed
*/
- public void removeAllCookies(ValueCallback<Boolean> callback) {
- throw new MustOverrideException();
- }
+ public abstract void removeAllCookies(ValueCallback<Boolean> callback);
/**
* Gets whether there are stored cookies.
*
* @return true if there are stored cookies
*/
- public synchronized boolean hasCookies() {
- throw new MustOverrideException();
- }
+ public abstract boolean hasCookies();
/**
* See {@link #hasCookies()}.
*
* @param privateBrowsing whether to use the private browsing cookie jar
- * @hide Used by Browser, no intention to publish.
+ * @hide Used by Browser and WebViewProvider implementations.
*/
- public synchronized boolean hasCookies(boolean privateBrowsing) {
- throw new MustOverrideException();
- }
+ @SystemApi
+ public abstract boolean hasCookies(boolean privateBrowsing);
/**
* Removes all expired cookies.
* @deprecated The WebView handles removing expired cookies automatically.
*/
@Deprecated
- public void removeExpiredCookie() {
- throw new MustOverrideException();
- }
+ public abstract void removeExpiredCookie();
/**
* Ensures all cookies currently accessible through the getCookie API are
* written to persistent storage.
* This call will block the caller until it is done and may perform I/O.
*/
- public void flush() {
- flushCookieStore();
- }
-
- /**
- * Flushes all cookies managed by the Chrome HTTP stack to flash.
- *
- * @hide Package level api, called from CookieSyncManager
- */
- protected void flushCookieStore() {
- }
+ public abstract void flush();
/**
* Gets whether the application's {@link WebView} instances send and accept
@@ -289,9 +248,8 @@
*
* @hide Only for use by WebViewProvider implementations
*/
- protected boolean allowFileSchemeCookiesImpl() {
- throw new MustOverrideException();
- }
+ @SystemApi
+ protected abstract boolean allowFileSchemeCookiesImpl();
/**
* Sets whether the application's {@link WebView} instances should send and
@@ -314,7 +272,6 @@
*
* @hide Only for use by WebViewProvider implementations
*/
- protected void setAcceptFileSchemeCookiesImpl(boolean accept) {
- throw new MustOverrideException();
- }
+ @SystemApi
+ protected abstract void setAcceptFileSchemeCookiesImpl(boolean accept);
}
diff --git a/core/java/android/webkit/DebugFlags.java b/core/java/android/webkit/DebugFlags.java
deleted file mode 100644
index 7b3cb1b..0000000
--- a/core/java/android/webkit/DebugFlags.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2009 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.webkit;
-
-/**
- * This class is a container for all of the debug flags used in the Java
- * components of webkit. These flags must be final in order to ensure that
- * the compiler optimizes the code that uses them out of the final executable.
- *
- * The name of each flags maps directly to the name of the class in which that
- * flag is used.
- *
- * @hide Only used by WebView implementations.
- */
-public class DebugFlags {
-
- public static final boolean COOKIE_SYNC_MANAGER = false;
- public static final boolean TRACE_API = false;
- public static final boolean TRACE_CALLBACK = false;
- public static final boolean URL_UTIL = false;
- public static final boolean WEB_SYNC_MANAGER = false;
-
-}
diff --git a/core/java/android/webkit/FindActionModeCallback.java b/core/java/android/webkit/FindActionModeCallback.java
index c68b450..ab6a2f9 100644
--- a/core/java/android/webkit/FindActionModeCallback.java
+++ b/core/java/android/webkit/FindActionModeCallback.java
@@ -16,6 +16,7 @@
package android.webkit;
+import android.annotation.SystemApi;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Point;
@@ -36,6 +37,7 @@
/**
* @hide
*/
+@SystemApi
public class FindActionModeCallback implements ActionMode.Callback, TextWatcher,
View.OnClickListener, WebView.FindListener {
private View mCustomView;
diff --git a/core/java/android/webkit/GeolocationPermissions.java b/core/java/android/webkit/GeolocationPermissions.java
index bc3d035..7187f22 100644
--- a/core/java/android/webkit/GeolocationPermissions.java
+++ b/core/java/android/webkit/GeolocationPermissions.java
@@ -16,6 +16,8 @@
package android.webkit;
+import android.annotation.SystemApi;
+
import java.util.Set;
/**
@@ -136,5 +138,6 @@
* way to call createHandler() and createUIHandler(), so it would not work).
* @hide Only for use by WebViewProvider implementations
*/
+ @SystemApi
public GeolocationPermissions() {}
}
diff --git a/core/java/android/webkit/HttpAuthHandler.java b/core/java/android/webkit/HttpAuthHandler.java
index ee3b3698..45fc1f5 100644
--- a/core/java/android/webkit/HttpAuthHandler.java
+++ b/core/java/android/webkit/HttpAuthHandler.java
@@ -16,6 +16,7 @@
package android.webkit;
+import android.annotation.SystemApi;
import android.os.Handler;
/**
@@ -30,6 +31,7 @@
/**
* @hide Only for use by WebViewProvider implementations.
*/
+ @SystemApi
public HttpAuthHandler() {
}
diff --git a/core/java/android/webkit/JsDialogHelper.java b/core/java/android/webkit/JsDialogHelper.java
index bb0339e..cc475c3 100644
--- a/core/java/android/webkit/JsDialogHelper.java
+++ b/core/java/android/webkit/JsDialogHelper.java
@@ -16,6 +16,7 @@
package android.webkit;
+import android.annotation.SystemApi;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
@@ -34,8 +35,9 @@
* Helper class to create JavaScript dialogs. It is used by
* different WebView implementations.
*
- * @hide Helper class for internal use
+ * @hide
*/
+@SystemApi
public class JsDialogHelper {
private static final String TAG = "JsDialogHelper";
diff --git a/core/java/android/webkit/JsPromptResult.java b/core/java/android/webkit/JsPromptResult.java
index a1bf124..771cc32 100644
--- a/core/java/android/webkit/JsPromptResult.java
+++ b/core/java/android/webkit/JsPromptResult.java
@@ -16,6 +16,8 @@
package android.webkit;
+import android.annotation.SystemApi;
+
/**
* Public class for handling JavaScript prompt requests. The WebChromeClient will receive a
@@ -39,6 +41,7 @@
/**
* @hide Only for use by WebViewProvider implementations
*/
+ @SystemApi
public JsPromptResult(ResultReceiver receiver) {
super(receiver);
}
@@ -46,6 +49,7 @@
/**
* @hide Only for use by WebViewProvider implementations
*/
+ @SystemApi
public String getStringResult() {
return mStringResult;
}
diff --git a/core/java/android/webkit/JsResult.java b/core/java/android/webkit/JsResult.java
index e4e6851..d36ab418 100644
--- a/core/java/android/webkit/JsResult.java
+++ b/core/java/android/webkit/JsResult.java
@@ -16,6 +16,8 @@
package android.webkit;
+import android.annotation.SystemApi;
+
/**
* An instance of this class is passed as a parameter in various {@link WebChromeClient} action
* notifications. The object is used as a handle onto the underlying JavaScript-originated request,
@@ -27,6 +29,7 @@
* notifications when the JavaScript result represented by a JsResult instance has
* @hide Only for use by WebViewProvider implementations
*/
+ @SystemApi
public interface ResultReceiver {
public void onJsResultComplete(JsResult result);
}
@@ -54,6 +57,7 @@
/**
* @hide Only for use by WebViewProvider implementations
*/
+ @SystemApi
public JsResult(ResultReceiver receiver) {
mReceiver = receiver;
}
@@ -61,6 +65,7 @@
/**
* @hide Only for use by WebViewProvider implementations
*/
+ @SystemApi
public final boolean getResult() {
return mResult;
}
diff --git a/core/java/android/webkit/MustOverrideException.java b/core/java/android/webkit/MustOverrideException.java
deleted file mode 100644
index 0643bf0..0000000
--- a/core/java/android/webkit/MustOverrideException.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (C) 2012 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.webkit;
-
-// TODO: Remove MustOverrideException and make all methods throwing it abstract instead;
-// needs API file update.
-class MustOverrideException extends RuntimeException {
- MustOverrideException() {
- super("abstract function called: must be overriden!");
- }
-}
\ No newline at end of file
diff --git a/core/java/android/webkit/SslErrorHandler.java b/core/java/android/webkit/SslErrorHandler.java
index af31544..537065d 100644
--- a/core/java/android/webkit/SslErrorHandler.java
+++ b/core/java/android/webkit/SslErrorHandler.java
@@ -16,6 +16,7 @@
package android.webkit;
+import android.annotation.SystemApi;
import android.os.Handler;
/**
@@ -30,6 +31,7 @@
/**
* @hide Only for use by WebViewProvider implementations.
*/
+ @SystemApi
public SslErrorHandler() {}
/**
diff --git a/core/java/android/webkit/URLUtil.java b/core/java/android/webkit/URLUtil.java
index d115984..f5233b6 100644
--- a/core/java/android/webkit/URLUtil.java
+++ b/core/java/android/webkit/URLUtil.java
@@ -29,6 +29,7 @@
public final class URLUtil {
private static final String LOGTAG = "webkit";
+ private static final boolean TRACE = false;
// to refer to bar.png under your package's asset/foo/ directory, use
// "file:///android_asset/foo/bar.png".
@@ -49,7 +50,7 @@
String retVal = inUrl;
WebAddress webAddress;
- if (DebugFlags.URL_UTIL) Log.v(LOGTAG, "guessURL before queueRequest: " + inUrl);
+ if (TRACE) Log.v(LOGTAG, "guessURL before queueRequest: " + inUrl);
if (inUrl.length() == 0) return inUrl;
if (inUrl.startsWith("about:")) return inUrl;
@@ -69,7 +70,7 @@
webAddress = new WebAddress(inUrl);
} catch (ParseException ex) {
- if (DebugFlags.URL_UTIL) {
+ if (TRACE) {
Log.v(LOGTAG, "smartUrlFilter: failed to parse url = " + inUrl);
}
return retVal;
@@ -286,7 +287,7 @@
}
return url;
}
-
+
/**
* Guesses canonical filename that a download would have, using
* the URL and contentDisposition. File extension, if not defined,
@@ -294,7 +295,7 @@
* @param url Url to the content
* @param contentDisposition Content-Disposition HTTP header or null
* @param mimeType Mime-type of the content or null
- *
+ *
* @return suggested filename
*/
public static final String guessFileName(
diff --git a/core/java/android/webkit/WebBackForwardList.java b/core/java/android/webkit/WebBackForwardList.java
index bfef2e7..e671376 100644
--- a/core/java/android/webkit/WebBackForwardList.java
+++ b/core/java/android/webkit/WebBackForwardList.java
@@ -16,6 +16,7 @@
package android.webkit;
+import android.annotation.SystemApi;
import java.io.Serializable;
/**
@@ -23,56 +24,38 @@
* WebView.copyBackForwardList() will return a copy of this class used to
* inspect the entries in the list.
*/
-public class WebBackForwardList implements Cloneable, Serializable {
-
- /**
- * @hide
- */
- public WebBackForwardList() {
- }
-
+public abstract class WebBackForwardList implements Cloneable, Serializable {
/**
* Return the current history item. This method returns null if the list is
* empty.
* @return The current history item.
*/
- public synchronized WebHistoryItem getCurrentItem() {
- throw new MustOverrideException();
- }
+ public abstract WebHistoryItem getCurrentItem();
/**
* Get the index of the current history item. This index can be used to
* directly index into the array list.
* @return The current index from 0...n or -1 if the list is empty.
*/
- public synchronized int getCurrentIndex() {
- throw new MustOverrideException();
- }
+ public abstract int getCurrentIndex();
/**
* Get the history item at the given index. The index range is from 0...n
* where 0 is the first item and n is the last item.
* @param index The index to retrieve.
*/
- public synchronized WebHistoryItem getItemAtIndex(int index) {
- throw new MustOverrideException();
- }
+ public abstract WebHistoryItem getItemAtIndex(int index);
/**
* Get the total size of the back/forward list.
* @return The size of the list.
*/
- public synchronized int getSize() {
- throw new MustOverrideException();
- }
+ public abstract int getSize();
/**
* Clone the entire object to be used in the UI thread by clients of
* WebView. This creates a copy that should never be modified by any of the
* webkit package classes.
*/
- protected synchronized WebBackForwardList clone() {
- throw new MustOverrideException();
- }
-
+ protected abstract WebBackForwardList clone();
}
diff --git a/core/java/android/webkit/WebChromeClient.java b/core/java/android/webkit/WebChromeClient.java
index 46a7fd0..768dc9f 100644
--- a/core/java/android/webkit/WebChromeClient.java
+++ b/core/java/android/webkit/WebChromeClient.java
@@ -16,6 +16,7 @@
package android.webkit;
+import android.annotation.SystemApi;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.graphics.Bitmap;
@@ -509,6 +510,7 @@
* @deprecated Use {@link #showFileChooser} instead.
* @hide This method was not published in any SDK version.
*/
+ @SystemApi
@Deprecated
public void openFileChooser(ValueCallback<Uri> uploadFile, String acceptType, String capture) {
uploadFile.onReceiveValue(null);
diff --git a/core/java/android/webkit/WebHistoryItem.java b/core/java/android/webkit/WebHistoryItem.java
index 9a588e4..569fccd 100644
--- a/core/java/android/webkit/WebHistoryItem.java
+++ b/core/java/android/webkit/WebHistoryItem.java
@@ -16,6 +16,7 @@
package android.webkit;
+import android.annotation.SystemApi;
import android.graphics.Bitmap;
/**
@@ -24,14 +25,7 @@
* item. Each history item may be updated during the load of a page.
* @see WebBackForwardList
*/
-public class WebHistoryItem implements Cloneable {
-
- /**
- * @hide
- */
- public WebHistoryItem() {
- }
-
+public abstract class WebHistoryItem implements Cloneable {
/**
* Return an identifier for this history item. If an item is a copy of
* another item, the identifiers will be the same even if they are not the
@@ -40,10 +34,9 @@
* @deprecated This method is now obsolete.
* @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1}
*/
+ @SystemApi
@Deprecated
- public int getId() {
- throw new MustOverrideException();
- }
+ public abstract int getId();
/**
* Return the url of this history item. The url is the base url of this
@@ -53,29 +46,23 @@
* Note: The VM ensures 32-bit atomic read/write operations so we don't have
* to synchronize this method.
*/
- public String getUrl() {
- throw new MustOverrideException();
- }
+ public abstract String getUrl();
/**
* Return the original url of this history item. This was the requested
- * url, the final url may be different as there might have been
+ * url, the final url may be different as there might have been
* redirects while loading the site.
* @return The original url of this history item.
*/
- public String getOriginalUrl() {
- throw new MustOverrideException();
- }
-
+ public abstract String getOriginalUrl();
+
/**
* Return the document title of this history item.
* @return The document title of this history item.
* Note: The VM ensures 32-bit atomic read/write operations so we don't have
* to synchronize this method.
*/
- public String getTitle() {
- throw new MustOverrideException();
- }
+ public abstract String getTitle();
/**
* Return the favicon of this history item or null if no favicon was found.
@@ -83,15 +70,10 @@
* Note: The VM ensures 32-bit atomic read/write operations so we don't have
* to synchronize this method.
*/
- public Bitmap getFavicon() {
- throw new MustOverrideException();
- }
+ public abstract Bitmap getFavicon();
/**
* Clone the history item for use by clients of WebView.
*/
- protected synchronized WebHistoryItem clone() {
- throw new MustOverrideException();
- }
-
+ protected abstract WebHistoryItem clone();
}
diff --git a/core/java/android/webkit/WebIconDatabase.java b/core/java/android/webkit/WebIconDatabase.java
index e574593..08956e0 100644
--- a/core/java/android/webkit/WebIconDatabase.java
+++ b/core/java/android/webkit/WebIconDatabase.java
@@ -16,6 +16,7 @@
package android.webkit;
+import android.annotation.SystemApi;
import android.content.ContentResolver;
import android.graphics.Bitmap;
@@ -32,7 +33,7 @@
* up to {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2}
*/
@Deprecated
-public class WebIconDatabase {
+public abstract class WebIconDatabase {
/**
* Interface for receiving icons from the database.
* @deprecated This interface is obsolete.
@@ -52,23 +53,17 @@
* Open a the icon database and store the icons in the given path.
* @param path The directory path where the icon database will be stored.
*/
- public void open(String path) {
- throw new MustOverrideException();
- }
+ public abstract void open(String path);
/**
* Close the shared instance of the icon database.
*/
- public void close() {
- throw new MustOverrideException();
- }
+ public abstract void close();
/**
* Removes all the icons in the database.
*/
- public void removeAllIcons() {
- throw new MustOverrideException();
- }
+ public abstract void removeAllIcons();
/**
* Request the Bitmap representing the icon for the given page
@@ -76,32 +71,25 @@
* @param url The page's url.
* @param listener An implementation on IconListener to receive the result.
*/
- public void requestIconForPageUrl(String url, IconListener listener) {
- throw new MustOverrideException();
- }
+ public abstract void requestIconForPageUrl(String url, IconListener listener);
/** {@hide}
*/
- public void bulkRequestIconForPageUrl(ContentResolver cr, String where,
- IconListener listener) {
- throw new MustOverrideException();
- }
+ @SystemApi
+ public abstract void bulkRequestIconForPageUrl(ContentResolver cr, String where,
+ IconListener listener);
/**
* Retain the icon for the given page url.
* @param url The page's url.
*/
- public void retainIconForPageUrl(String url) {
- throw new MustOverrideException();
- }
+ public abstract void retainIconForPageUrl(String url);
/**
* Release the icon for the given page url.
* @param url The page's url.
*/
- public void releaseIconForPageUrl(String url) {
- throw new MustOverrideException();
- }
+ public abstract void releaseIconForPageUrl(String url);
/**
* Get the global instance of WebIconDatabase.
@@ -113,9 +101,4 @@
// XXX: Must be created in the UI thread.
return WebViewFactory.getProvider().getWebIconDatabase();
}
-
- /**
- * @hide Only for use by WebViewProvider implementations
- */
- protected WebIconDatabase() {}
}
diff --git a/core/java/android/webkit/WebSettings.java b/core/java/android/webkit/WebSettings.java
index 7cf3cb5..1d2c311 100644
--- a/core/java/android/webkit/WebSettings.java
+++ b/core/java/android/webkit/WebSettings.java
@@ -204,25 +204,15 @@
public static final int MIXED_CONTENT_COMPATIBILITY_MODE = 2;
/**
- * Hidden constructor to prevent clients from creating a new settings
- * instance or deriving the class.
- *
- * @hide
- */
- protected WebSettings() {
- }
-
- /**
* Enables dumping the pages navigation cache to a text file. The default
* is false.
*
* @deprecated This method is now obsolete.
* @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1}
*/
+ @SystemApi
@Deprecated
- public void setNavDump(boolean enabled) {
- throw new MustOverrideException();
- }
+ public abstract void setNavDump(boolean enabled);
/**
* Gets whether dumping the navigation cache is enabled.
@@ -232,10 +222,9 @@
* @deprecated This method is now obsolete.
* @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1}
*/
+ @SystemApi
@Deprecated
- public boolean getNavDump() {
- throw new MustOverrideException();
- }
+ public abstract boolean getNavDump();
/**
* Sets whether the WebView should support zooming using its on-screen zoom
@@ -246,9 +235,7 @@
*
* @param support whether the WebView should support zoom
*/
- public void setSupportZoom(boolean support) {
- throw new MustOverrideException();
- }
+ public abstract void setSupportZoom(boolean support);
/**
* Gets whether the WebView supports zoom.
@@ -256,9 +243,7 @@
* @return true if the WebView supports zoom
* @see #setSupportZoom
*/
- public boolean supportZoom() {
- throw new MustOverrideException();
- }
+ public abstract boolean supportZoom();
/**
* Sets whether the WebView requires a user gesture to play media.
@@ -266,9 +251,7 @@
*
* @param require whether the WebView requires a user gesture to play media
*/
- public void setMediaPlaybackRequiresUserGesture(boolean require) {
- throw new MustOverrideException();
- }
+ public abstract void setMediaPlaybackRequiresUserGesture(boolean require);
/**
* Gets whether the WebView requires a user gesture to play media.
@@ -276,9 +259,7 @@
* @return true if the WebView requires a user gesture to play media
* @see #setMediaPlaybackRequiresUserGesture
*/
- public boolean getMediaPlaybackRequiresUserGesture() {
- throw new MustOverrideException();
- }
+ public abstract boolean getMediaPlaybackRequiresUserGesture();
/**
* Sets whether the WebView should use its built-in zoom mechanisms. The
@@ -295,9 +276,7 @@
// This method was intended to select between the built-in zoom mechanisms
// and the separate zoom controls. The latter were obtained using
// {@link WebView#getZoomControls}, which is now hidden.
- public void setBuiltInZoomControls(boolean enabled) {
- throw new MustOverrideException();
- }
+ public abstract void setBuiltInZoomControls(boolean enabled);
/**
* Gets whether the zoom mechanisms built into WebView are being used.
@@ -305,9 +284,7 @@
* @return true if the zoom mechanisms built into WebView are being used
* @see #setBuiltInZoomControls
*/
- public boolean getBuiltInZoomControls() {
- throw new MustOverrideException();
- }
+ public abstract boolean getBuiltInZoomControls();
/**
* Sets whether the WebView should display on-screen zoom controls when
@@ -316,9 +293,7 @@
*
* @param enabled whether the WebView should display on-screen zoom controls
*/
- public void setDisplayZoomControls(boolean enabled) {
- throw new MustOverrideException();
- }
+ public abstract void setDisplayZoomControls(boolean enabled);
/**
* Gets whether the WebView displays on-screen zoom controls when using
@@ -328,9 +303,7 @@
* the built-in zoom mechanisms
* @see #setDisplayZoomControls
*/
- public boolean getDisplayZoomControls() {
- throw new MustOverrideException();
- }
+ public abstract boolean getDisplayZoomControls();
/**
* Enables or disables file access within WebView. File access is enabled by
@@ -338,36 +311,28 @@
* Assets and resources are still accessible using file:///android_asset and
* file:///android_res.
*/
- public void setAllowFileAccess(boolean allow) {
- throw new MustOverrideException();
- }
+ public abstract void setAllowFileAccess(boolean allow);
/**
* Gets whether this WebView supports file access.
*
* @see #setAllowFileAccess
*/
- public boolean getAllowFileAccess() {
- throw new MustOverrideException();
- }
+ public abstract boolean getAllowFileAccess();
/**
* Enables or disables content URL access within WebView. Content URL
* access allows WebView to load content from a content provider installed
* in the system. The default is enabled.
*/
- public void setAllowContentAccess(boolean allow) {
- throw new MustOverrideException();
- }
+ public abstract void setAllowContentAccess(boolean allow);
/**
* Gets whether this WebView supports content URL access.
*
* @see #setAllowContentAccess
*/
- public boolean getAllowContentAccess() {
- throw new MustOverrideException();
- }
+ public abstract boolean getAllowContentAccess();
/**
* Sets whether the WebView loads pages in overview mode, that is,
@@ -376,9 +341,7 @@
* of the WebView control, for example, when {@link #getUseWideViewPort}
* is enabled. The default is false.
*/
- public void setLoadWithOverviewMode(boolean overview) {
- throw new MustOverrideException();
- }
+ public abstract void setLoadWithOverviewMode(boolean overview);
/**
* Gets whether this WebView loads pages in overview mode.
@@ -386,9 +349,7 @@
* @return whether this WebView loads pages in overview mode
* @see #setLoadWithOverviewMode
*/
- public boolean getLoadWithOverviewMode() {
- throw new MustOverrideException();
- }
+ public abstract boolean getLoadWithOverviewMode();
/**
* Sets whether the WebView will enable smooth transition while panning or
@@ -400,9 +361,7 @@
* @deprecated This method is now obsolete, and will become a no-op in future.
*/
@Deprecated
- public void setEnableSmoothTransition(boolean enable) {
- throw new MustOverrideException();
- }
+ public abstract void setEnableSmoothTransition(boolean enable);
/**
* Gets whether the WebView enables smooth transition while panning or
@@ -413,9 +372,7 @@
* @deprecated This method is now obsolete, and will become a no-op in future.
*/
@Deprecated
- public boolean enableSmoothTransition() {
- throw new MustOverrideException();
- }
+ public abstract boolean enableSmoothTransition();
/**
* Sets whether the WebView uses its background for over scroll background.
@@ -425,10 +382,9 @@
* @deprecated This method is now obsolete.
* @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1}
*/
+ @SystemApi
@Deprecated
- public void setUseWebViewBackgroundForOverscrollBackground(boolean view) {
- throw new MustOverrideException();
- }
+ public abstract void setUseWebViewBackgroundForOverscrollBackground(boolean view);
/**
* Gets whether this WebView uses WebView's background instead of
@@ -438,17 +394,14 @@
* @deprecated This method is now obsolete.
* @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1}
*/
+ @SystemApi
@Deprecated
- public boolean getUseWebViewBackgroundForOverscrollBackground() {
- throw new MustOverrideException();
- }
+ public abstract boolean getUseWebViewBackgroundForOverscrollBackground();
/**
* Sets whether the WebView should save form data. The default is true.
*/
- public void setSaveFormData(boolean save) {
- throw new MustOverrideException();
- }
+ public abstract void setSaveFormData(boolean save);
/**
* Gets whether the WebView saves form data.
@@ -456,18 +409,14 @@
* @return whether the WebView saves form data
* @see #setSaveFormData
*/
- public boolean getSaveFormData() {
- throw new MustOverrideException();
- }
+ public abstract boolean getSaveFormData();
/**
* Sets whether the WebView should save passwords. The default is true.
* @deprecated Saving passwords in WebView will not be supported in future versions.
*/
@Deprecated
- public void setSavePassword(boolean save) {
- throw new MustOverrideException();
- }
+ public abstract void setSavePassword(boolean save);
/**
* Gets whether the WebView saves passwords.
@@ -477,18 +426,14 @@
* @deprecated Saving passwords in WebView will not be supported in future versions.
*/
@Deprecated
- public boolean getSavePassword() {
- throw new MustOverrideException();
- }
+ public abstract boolean getSavePassword();
/**
* Sets the text zoom of the page in percent. The default is 100.
*
* @param textZoom the text zoom in percent
*/
- public synchronized void setTextZoom(int textZoom) {
- throw new MustOverrideException();
- }
+ public abstract void setTextZoom(int textZoom);
/**
* Gets the text zoom of the page in percent.
@@ -496,27 +441,23 @@
* @return the text zoom of the page in percent
* @see #setTextZoom
*/
- public synchronized int getTextZoom() {
- throw new MustOverrideException();
- }
+ public abstract int getTextZoom();
/**
* Sets policy for third party cookies.
* Developers should access this via {@link CookieManager#setShouldAcceptThirdPartyCookies}.
* @hide Internal API.
*/
- public void setAcceptThirdPartyCookies(boolean accept) {
- throw new MustOverrideException();
- }
+ @SystemApi
+ public abstract void setAcceptThirdPartyCookies(boolean accept);
/**
* Gets policy for third party cookies.
* Developers should access this via {@link CookieManager#getShouldAcceptThirdPartyCookies}.
* @hide Internal API
*/
- public boolean getAcceptThirdPartyCookies() {
- throw new MustOverrideException();
- }
+ @SystemApi
+ public abstract boolean getAcceptThirdPartyCookies();
/**
* Sets the text size of the page. The default is {@link TextSize#NORMAL}.
@@ -569,9 +510,7 @@
* recommended alternatives.
*/
@Deprecated
- public void setDefaultZoom(ZoomDensity zoom) {
- throw new MustOverrideException();
- }
+ public abstract void setDefaultZoom(ZoomDensity zoom);
/**
* Gets the default zoom density of the page. This should be called from
@@ -583,9 +522,7 @@
* @see #setDefaultZoom
* @deprecated Will only return the default value.
*/
- public ZoomDensity getDefaultZoom() {
- throw new MustOverrideException();
- }
+ public abstract ZoomDensity getDefaultZoom();
/**
* Enables using light touches to make a selection and activate mouseovers.
@@ -593,9 +530,7 @@
* setting is obsolete and has no effect.
*/
@Deprecated
- public void setLightTouchEnabled(boolean enabled) {
- throw new MustOverrideException();
- }
+ public abstract void setLightTouchEnabled(boolean enabled);
/**
* Gets whether light touches are enabled.
@@ -603,9 +538,7 @@
* @deprecated This setting is obsolete.
*/
@Deprecated
- public boolean getLightTouchEnabled() {
- throw new MustOverrideException();
- }
+ public abstract boolean getLightTouchEnabled();
/**
* Controlled a rendering optimization that is no longer present. Setting
@@ -615,7 +548,7 @@
* @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1}
*/
@Deprecated
- public synchronized void setUseDoubleTree(boolean use) {
+ public void setUseDoubleTree(boolean use) {
// Specified to do nothing, so no need for derived classes to override.
}
@@ -627,7 +560,7 @@
* @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1}
*/
@Deprecated
- public synchronized boolean getUseDoubleTree() {
+ public boolean getUseDoubleTree() {
// Returns false unconditionally, so no need for derived classes to override.
return false;
}
@@ -645,10 +578,9 @@
* @deprecated Please use {@link #setUserAgentString} instead.
* @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1}
*/
+ @SystemApi
@Deprecated
- public synchronized void setUserAgent(int ua) {
- throw new MustOverrideException();
- }
+ public abstract void setUserAgent(int ua);
/**
* Gets the user-agent as an integer code.
@@ -664,10 +596,9 @@
* @deprecated Please use {@link #getUserAgentString} instead.
* @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1}
*/
+ @SystemApi
@Deprecated
- public synchronized int getUserAgent() {
- throw new MustOverrideException();
- }
+ public abstract int getUserAgent();
/**
* Sets whether the WebView should enable support for the "viewport"
@@ -680,9 +611,7 @@
*
* @param use whether to enable support for the viewport meta tag
*/
- public synchronized void setUseWideViewPort(boolean use) {
- throw new MustOverrideException();
- }
+ public abstract void setUseWideViewPort(boolean use);
/**
* Gets whether the WebView supports the "viewport"
@@ -691,9 +620,7 @@
* @return true if the WebView supports the viewport meta tag
* @see #setUseWideViewPort
*/
- public synchronized boolean getUseWideViewPort() {
- throw new MustOverrideException();
- }
+ public abstract boolean getUseWideViewPort();
/**
* Sets whether the WebView whether supports multiple windows. If set to
@@ -702,9 +629,7 @@
*
* @param support whether to suport multiple windows
*/
- public synchronized void setSupportMultipleWindows(boolean support) {
- throw new MustOverrideException();
- }
+ public abstract void setSupportMultipleWindows(boolean support);
/**
* Gets whether the WebView supports multiple windows.
@@ -712,9 +637,7 @@
* @return true if the WebView supports multiple windows
* @see #setSupportMultipleWindows
*/
- public synchronized boolean supportMultipleWindows() {
- throw new MustOverrideException();
- }
+ public abstract boolean supportMultipleWindows();
/**
* Sets the underlying layout algorithm. This will cause a relayout of the
@@ -722,9 +645,7 @@
*
* @param l the layout algorithm to use, as a {@link LayoutAlgorithm} value
*/
- public synchronized void setLayoutAlgorithm(LayoutAlgorithm l) {
- throw new MustOverrideException();
- }
+ public abstract void setLayoutAlgorithm(LayoutAlgorithm l);
/**
* Gets the current layout algorithm.
@@ -732,18 +653,14 @@
* @return the layout algorithm in use, as a {@link LayoutAlgorithm} value
* @see #setLayoutAlgorithm
*/
- public synchronized LayoutAlgorithm getLayoutAlgorithm() {
- throw new MustOverrideException();
- }
+ public abstract LayoutAlgorithm getLayoutAlgorithm();
/**
* Sets the standard font family name. The default is "sans-serif".
*
* @param font a font family name
*/
- public synchronized void setStandardFontFamily(String font) {
- throw new MustOverrideException();
- }
+ public abstract void setStandardFontFamily(String font);
/**
* Gets the standard font family name.
@@ -751,18 +668,14 @@
* @return the standard font family name as a string
* @see #setStandardFontFamily
*/
- public synchronized String getStandardFontFamily() {
- throw new MustOverrideException();
- }
+ public abstract String getStandardFontFamily();
/**
* Sets the fixed font family name. The default is "monospace".
*
* @param font a font family name
*/
- public synchronized void setFixedFontFamily(String font) {
- throw new MustOverrideException();
- }
+ public abstract void setFixedFontFamily(String font);
/**
* Gets the fixed font family name.
@@ -770,18 +683,14 @@
* @return the fixed font family name as a string
* @see #setFixedFontFamily
*/
- public synchronized String getFixedFontFamily() {
- throw new MustOverrideException();
- }
+ public abstract String getFixedFontFamily();
/**
* Sets the sans-serif font family name. The default is "sans-serif".
*
* @param font a font family name
*/
- public synchronized void setSansSerifFontFamily(String font) {
- throw new MustOverrideException();
- }
+ public abstract void setSansSerifFontFamily(String font);
/**
* Gets the sans-serif font family name.
@@ -789,18 +698,14 @@
* @return the sans-serif font family name as a string
* @see #setSansSerifFontFamily
*/
- public synchronized String getSansSerifFontFamily() {
- throw new MustOverrideException();
- }
+ public abstract String getSansSerifFontFamily();
/**
* Sets the serif font family name. The default is "sans-serif".
*
* @param font a font family name
*/
- public synchronized void setSerifFontFamily(String font) {
- throw new MustOverrideException();
- }
+ public abstract void setSerifFontFamily(String font);
/**
* Gets the serif font family name. The default is "serif".
@@ -808,18 +713,14 @@
* @return the serif font family name as a string
* @see #setSerifFontFamily
*/
- public synchronized String getSerifFontFamily() {
- throw new MustOverrideException();
- }
+ public abstract String getSerifFontFamily();
/**
* Sets the cursive font family name. The default is "cursive".
*
* @param font a font family name
*/
- public synchronized void setCursiveFontFamily(String font) {
- throw new MustOverrideException();
- }
+ public abstract void setCursiveFontFamily(String font);
/**
* Gets the cursive font family name.
@@ -827,18 +728,14 @@
* @return the cursive font family name as a string
* @see #setCursiveFontFamily
*/
- public synchronized String getCursiveFontFamily() {
- throw new MustOverrideException();
- }
+ public abstract String getCursiveFontFamily();
/**
* Sets the fantasy font family name. The default is "fantasy".
*
* @param font a font family name
*/
- public synchronized void setFantasyFontFamily(String font) {
- throw new MustOverrideException();
- }
+ public abstract void setFantasyFontFamily(String font);
/**
* Gets the fantasy font family name.
@@ -846,9 +743,7 @@
* @return the fantasy font family name as a string
* @see #setFantasyFontFamily
*/
- public synchronized String getFantasyFontFamily() {
- throw new MustOverrideException();
- }
+ public abstract String getFantasyFontFamily();
/**
* Sets the minimum font size. The default is 8.
@@ -856,9 +751,7 @@
* @param size a non-negative integer between 1 and 72. Any number outside
* the specified range will be pinned.
*/
- public synchronized void setMinimumFontSize(int size) {
- throw new MustOverrideException();
- }
+ public abstract void setMinimumFontSize(int size);
/**
* Gets the minimum font size.
@@ -866,9 +759,7 @@
* @return a non-negative integer between 1 and 72
* @see #setMinimumFontSize
*/
- public synchronized int getMinimumFontSize() {
- throw new MustOverrideException();
- }
+ public abstract int getMinimumFontSize();
/**
* Sets the minimum logical font size. The default is 8.
@@ -876,9 +767,7 @@
* @param size a non-negative integer between 1 and 72. Any number outside
* the specified range will be pinned.
*/
- public synchronized void setMinimumLogicalFontSize(int size) {
- throw new MustOverrideException();
- }
+ public abstract void setMinimumLogicalFontSize(int size);
/**
* Gets the minimum logical font size.
@@ -886,9 +775,7 @@
* @return a non-negative integer between 1 and 72
* @see #setMinimumLogicalFontSize
*/
- public synchronized int getMinimumLogicalFontSize() {
- throw new MustOverrideException();
- }
+ public abstract int getMinimumLogicalFontSize();
/**
* Sets the default font size. The default is 16.
@@ -896,9 +783,7 @@
* @param size a non-negative integer between 1 and 72. Any number outside
* the specified range will be pinned.
*/
- public synchronized void setDefaultFontSize(int size) {
- throw new MustOverrideException();
- }
+ public abstract void setDefaultFontSize(int size);
/**
* Gets the default font size.
@@ -906,9 +791,7 @@
* @return a non-negative integer between 1 and 72
* @see #setDefaultFontSize
*/
- public synchronized int getDefaultFontSize() {
- throw new MustOverrideException();
- }
+ public abstract int getDefaultFontSize();
/**
* Sets the default fixed font size. The default is 16.
@@ -916,9 +799,7 @@
* @param size a non-negative integer between 1 and 72. Any number outside
* the specified range will be pinned.
*/
- public synchronized void setDefaultFixedFontSize(int size) {
- throw new MustOverrideException();
- }
+ public abstract void setDefaultFixedFontSize(int size);
/**
* Gets the default fixed font size.
@@ -926,9 +807,7 @@
* @return a non-negative integer between 1 and 72
* @see #setDefaultFixedFontSize
*/
- public synchronized int getDefaultFixedFontSize() {
- throw new MustOverrideException();
- }
+ public abstract int getDefaultFixedFontSize();
/**
* Sets whether the WebView should load image resources. Note that this method
@@ -941,9 +820,7 @@
*
* @param flag whether the WebView should load image resources
*/
- public synchronized void setLoadsImagesAutomatically(boolean flag) {
- throw new MustOverrideException();
- }
+ public abstract void setLoadsImagesAutomatically(boolean flag);
/**
* Gets whether the WebView loads image resources. This includes
@@ -952,9 +829,7 @@
* @return true if the WebView loads image resources
* @see #setLoadsImagesAutomatically
*/
- public synchronized boolean getLoadsImagesAutomatically() {
- throw new MustOverrideException();
- }
+ public abstract boolean getLoadsImagesAutomatically();
/**
* Sets whether the WebView should not load image resources from the
@@ -971,9 +846,7 @@
* network
* @see #setBlockNetworkLoads
*/
- public synchronized void setBlockNetworkImage(boolean flag) {
- throw new MustOverrideException();
- }
+ public abstract void setBlockNetworkImage(boolean flag);
/**
* Gets whether the WebView does not load image resources from the network.
@@ -981,9 +854,7 @@
* @return true if the WebView does not load image resources from the network
* @see #setBlockNetworkImage
*/
- public synchronized boolean getBlockNetworkImage() {
- throw new MustOverrideException();
- }
+ public abstract boolean getBlockNetworkImage();
/**
* Sets whether the WebView should not load resources from the network.
@@ -1003,9 +874,7 @@
* network
* @see android.webkit.WebView#reload
*/
- public synchronized void setBlockNetworkLoads(boolean flag) {
- throw new MustOverrideException();
- }
+ public abstract void setBlockNetworkLoads(boolean flag);
/**
* Gets whether the WebView does not load any resources from the network.
@@ -1013,9 +882,7 @@
* @return true if the WebView does not load any resources from the network
* @see #setBlockNetworkLoads
*/
- public synchronized boolean getBlockNetworkLoads() {
- throw new MustOverrideException();
- }
+ public abstract boolean getBlockNetworkLoads();
/**
* Tells the WebView to enable JavaScript execution.
@@ -1023,9 +890,7 @@
*
* @param flag true if the WebView should execute JavaScript
*/
- public synchronized void setJavaScriptEnabled(boolean flag) {
- throw new MustOverrideException();
- }
+ public abstract void setJavaScriptEnabled(boolean flag);
/**
* Sets whether JavaScript running in the context of a file scheme URL
@@ -1076,10 +941,9 @@
* {@link #setPluginState}
* @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2}
*/
+ @SystemApi
@Deprecated
- public synchronized void setPluginsEnabled(boolean flag) {
- throw new MustOverrideException();
- }
+ public abstract void setPluginsEnabled(boolean flag);
/**
* Tells the WebView to enable, disable, or have plugins on demand. On
@@ -1092,9 +956,7 @@
* @deprecated Plugins will not be supported in future, and should not be used.
*/
@Deprecated
- public synchronized void setPluginState(PluginState state) {
- throw new MustOverrideException();
- }
+ public abstract void setPluginState(PluginState state);
/**
* Sets a custom path to plugins used by the WebView. This method is
@@ -1106,7 +968,7 @@
* @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2}
*/
@Deprecated
- public synchronized void setPluginsPath(String pluginsPath) {
+ public void setPluginsPath(String pluginsPath) {
// Specified to do nothing, so no need for derived classes to override.
}
@@ -1125,9 +987,7 @@
// Note that the WebCore Database Tracker only allows the path to be set
// once.
@Deprecated
- public synchronized void setDatabasePath(String databasePath) {
- throw new MustOverrideException();
- }
+ public abstract void setDatabasePath(String databasePath);
/**
* Sets the path where the Geolocation databases should be saved. In order
@@ -1138,9 +998,7 @@
* saved.
*/
// This will update WebCore when the Sync runs in the C++ side.
- public synchronized void setGeolocationDatabasePath(String databasePath) {
- throw new MustOverrideException();
- }
+ public abstract void setGeolocationDatabasePath(String databasePath);
/**
* Sets whether the Application Caches API should be enabled. The default
@@ -1150,9 +1008,7 @@
*
* @param flag true if the WebView should enable Application Caches
*/
- public synchronized void setAppCacheEnabled(boolean flag) {
- throw new MustOverrideException();
- }
+ public abstract void setAppCacheEnabled(boolean flag);
/**
* Sets the path to the Application Caches files. In order for the
@@ -1164,9 +1020,7 @@
* Application Caches files.
* @see #setAppCacheEnabled
*/
- public synchronized void setAppCachePath(String appCachePath) {
- throw new MustOverrideException();
- }
+ public abstract void setAppCachePath(String appCachePath);
/**
* Sets the maximum size for the Application Cache content. The passed size
@@ -1180,9 +1034,7 @@
* @deprecated In future quota will be managed automatically.
*/
@Deprecated
- public synchronized void setAppCacheMaxSize(long appCacheMaxSize) {
- throw new MustOverrideException();
- }
+ public abstract void setAppCacheMaxSize(long appCacheMaxSize);
/**
* Sets whether the database storage API is enabled. The default value is
@@ -1196,18 +1048,14 @@
*
* @param flag true if the WebView should use the database storage API
*/
- public synchronized void setDatabaseEnabled(boolean flag) {
- throw new MustOverrideException();
- }
+ public abstract void setDatabaseEnabled(boolean flag);
/**
* Sets whether the DOM storage API is enabled. The default value is false.
*
* @param flag true if the WebView should use the DOM storage API
*/
- public synchronized void setDomStorageEnabled(boolean flag) {
- throw new MustOverrideException();
- }
+ public abstract void setDomStorageEnabled(boolean flag);
/**
* Gets whether the DOM Storage APIs are enabled.
@@ -1215,9 +1063,8 @@
* @return true if the DOM Storage APIs are enabled
* @see #setDomStorageEnabled
*/
- public synchronized boolean getDomStorageEnabled() {
- throw new MustOverrideException();
- }
+ public abstract boolean getDomStorageEnabled();
+
/**
* Gets the path to where database storage API databases are saved.
*
@@ -1226,9 +1073,7 @@
* @deprecated Database paths are managed by the implementation this method is obsolete.
*/
@Deprecated
- public synchronized String getDatabasePath() {
- throw new MustOverrideException();
- }
+ public abstract String getDatabasePath();
/**
* Gets whether the database storage API is enabled.
@@ -1236,9 +1081,7 @@
* @return true if the database storage API is enabled
* @see #setDatabaseEnabled
*/
- public synchronized boolean getDatabaseEnabled() {
- throw new MustOverrideException();
- }
+ public abstract boolean getDatabaseEnabled();
/**
* Sets whether Geolocation is enabled. The default is true.
@@ -1260,9 +1103,7 @@
*
* @param flag whether Geolocation should be enabled
*/
- public synchronized void setGeolocationEnabled(boolean flag) {
- throw new MustOverrideException();
- }
+ public abstract void setGeolocationEnabled(boolean flag);
/**
* Gets whether JavaScript is enabled.
@@ -1270,9 +1111,7 @@
* @return true if JavaScript is enabled
* @see #setJavaScriptEnabled
*/
- public synchronized boolean getJavaScriptEnabled() {
- throw new MustOverrideException();
- }
+ public abstract boolean getJavaScriptEnabled();
/**
* Gets whether JavaScript running in the context of a file scheme URL can
@@ -1303,10 +1142,9 @@
* @deprecated This method has been replaced by {@link #getPluginState}
* @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2}
*/
+ @SystemApi
@Deprecated
- public synchronized boolean getPluginsEnabled() {
- throw new MustOverrideException();
- }
+ public abstract boolean getPluginsEnabled();
/**
* Gets the current state regarding whether plugins are enabled.
@@ -1316,9 +1154,7 @@
* @deprecated Plugins will not be supported in future, and should not be used.
*/
@Deprecated
- public synchronized PluginState getPluginState() {
- throw new MustOverrideException();
- }
+ public abstract PluginState getPluginState();
/**
* Gets the directory that contains the plugin libraries. This method is
@@ -1330,7 +1166,7 @@
* @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2}
*/
@Deprecated
- public synchronized String getPluginsPath() {
+ public String getPluginsPath() {
// Unconditionally returns empty string, so no need for derived classes to override.
return "";
}
@@ -1341,9 +1177,7 @@
*
* @param flag true if JavaScript can open windows automatically
*/
- public synchronized void setJavaScriptCanOpenWindowsAutomatically(boolean flag) {
- throw new MustOverrideException();
- }
+ public abstract void setJavaScriptCanOpenWindowsAutomatically(boolean flag);
/**
* Gets whether JavaScript can open windows automatically.
@@ -1352,9 +1186,7 @@
* window.open()
* @see #setJavaScriptCanOpenWindowsAutomatically
*/
- public synchronized boolean getJavaScriptCanOpenWindowsAutomatically() {
- throw new MustOverrideException();
- }
+ public abstract boolean getJavaScriptCanOpenWindowsAutomatically();
/**
* Sets the default text encoding name to use when decoding html pages.
@@ -1362,9 +1194,7 @@
*
* @param encoding the text encoding name
*/
- public synchronized void setDefaultTextEncodingName(String encoding) {
- throw new MustOverrideException();
- }
+ public abstract void setDefaultTextEncodingName(String encoding);
/**
* Gets the default text encoding name.
@@ -1372,17 +1202,13 @@
* @return the default text encoding name as a string
* @see #setDefaultTextEncodingName
*/
- public synchronized String getDefaultTextEncodingName() {
- throw new MustOverrideException();
- }
+ public abstract String getDefaultTextEncodingName();
/**
* Sets the WebView's user-agent string. If the string is null or empty,
* the system default value will be used.
*/
- public synchronized void setUserAgentString(String ua) {
- throw new MustOverrideException();
- }
+ public abstract void setUserAgentString(String ua);
/**
* Gets the WebView's user-agent string.
@@ -1390,9 +1216,7 @@
* @return the WebView's user-agent string
* @see #setUserAgentString
*/
- public synchronized String getUserAgentString() {
- throw new MustOverrideException();
- }
+ public abstract String getUserAgentString();
/**
* Returns the default User-Agent used by a WebView.
@@ -1412,9 +1236,7 @@
*
* @param flag whether the WebView needs to set a node
*/
- public void setNeedInitialFocus(boolean flag) {
- throw new MustOverrideException();
- }
+ public abstract void setNeedInitialFocus(boolean flag);
/**
* Sets the priority of the Render thread. Unlike the other settings, this
@@ -1426,9 +1248,7 @@
* not be supported in future versions.
*/
@Deprecated
- public synchronized void setRenderPriority(RenderPriority priority) {
- throw new MustOverrideException();
- }
+ public abstract void setRenderPriority(RenderPriority priority);
/**
* Overrides the way the cache is used. The way the cache is used is based
@@ -1442,9 +1262,7 @@
*
* @param mode the mode to use
*/
- public void setCacheMode(int mode) {
- throw new MustOverrideException();
- }
+ public abstract void setCacheMode(int mode);
/**
* Gets the current setting for overriding the cache mode.
@@ -1452,9 +1270,7 @@
* @return the current setting for overriding the cache mode
* @see #setCacheMode
*/
- public int getCacheMode() {
- throw new MustOverrideException();
- }
+ public abstract int getCacheMode();
/**
* Configures the WebView's behavior when a secure origin attempts to load a resource from an
diff --git a/core/java/android/webkit/WebStorage.java b/core/java/android/webkit/WebStorage.java
index 3bfe9cf..947d0cb 100644
--- a/core/java/android/webkit/WebStorage.java
+++ b/core/java/android/webkit/WebStorage.java
@@ -16,6 +16,8 @@
package android.webkit;
+import android.annotation.SystemApi;
+
import java.util.Map;
/**
@@ -65,23 +67,13 @@
private long mUsage = 0;
/** @hide */
+ @SystemApi
protected Origin(String origin, long quota, long usage) {
mOrigin = origin;
mQuota = quota;
mUsage = usage;
}
- /** @hide */
- protected Origin(String origin, long quota) {
- mOrigin = origin;
- mQuota = quota;
- }
-
- /** @hide */
- protected Origin(String origin) {
- mOrigin = origin;
- }
-
/**
* Gets the string representation of this origin.
*
@@ -210,5 +202,6 @@
* way to call createHandler() and createUIHandler(), so it would not work).
* @hide
*/
+ @SystemApi
public WebStorage() {}
}
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 40aee96..8d2c51f 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -16,6 +16,7 @@
package android.webkit;
+import android.annotation.SystemApi;
import android.annotation.Widget;
import android.content.Context;
import android.content.res.Configuration;
@@ -256,10 +257,12 @@
* always stay as a hidden API.
* @hide
*/
+ @SystemApi
public static final String DATA_REDUCTION_PROXY_SETTING_CHANGED =
"android.webkit.DATA_REDUCTION_PROXY_SETTING_CHANGED";
private static final String LOGTAG = "WebView";
+ private static final boolean TRACE = false;
// Throwing an exception for incorrect thread usage if the
// build target is JB MR2 or newer. Defaults to false, and is
@@ -394,6 +397,7 @@
/**
* @hide Only for use by WebViewProvider implementations
*/
+ @SystemApi
public HitTestResult() {
mType = UNKNOWN_TYPE;
}
@@ -401,6 +405,7 @@
/**
* @hide Only for use by WebViewProvider implementations
*/
+ @SystemApi
public void setType(int type) {
mType = type;
}
@@ -408,6 +413,7 @@
/**
* @hide Only for use by WebViewProvider implementations
*/
+ @SystemApi
public void setExtra(String extra) {
mExtra = extra;
}
@@ -542,7 +548,7 @@
sEnforceThreadChecking = context.getApplicationInfo().targetSdkVersion >=
Build.VERSION_CODES.JELLY_BEAN_MR2;
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "WebView<init>");
+ if (TRACE) Log.d(LOGTAG, "WebView<init>");
ensureProviderCreated();
mProvider.init(javaScriptInterfaces, privateBrowsing);
@@ -557,7 +563,7 @@
*/
public void setHorizontalScrollbarOverlay(boolean overlay) {
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "setHorizontalScrollbarOverlay=" + overlay);
+ if (TRACE) Log.d(LOGTAG, "setHorizontalScrollbarOverlay=" + overlay);
mProvider.setHorizontalScrollbarOverlay(overlay);
}
@@ -568,7 +574,7 @@
*/
public void setVerticalScrollbarOverlay(boolean overlay) {
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "setVerticalScrollbarOverlay=" + overlay);
+ if (TRACE) Log.d(LOGTAG, "setVerticalScrollbarOverlay=" + overlay);
mProvider.setVerticalScrollbarOverlay(overlay);
}
@@ -623,7 +629,7 @@
@Deprecated
public void setCertificate(SslCertificate certificate) {
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "setCertificate=" + certificate);
+ if (TRACE) Log.d(LOGTAG, "setCertificate=" + certificate);
mProvider.setCertificate(certificate);
}
@@ -647,7 +653,7 @@
@Deprecated
public void savePassword(String host, String username, String password) {
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "savePassword=" + host);
+ if (TRACE) Log.d(LOGTAG, "savePassword=" + host);
mProvider.savePassword(host, username, password);
}
@@ -667,7 +673,7 @@
public void setHttpAuthUsernamePassword(String host, String realm,
String username, String password) {
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "setHttpAuthUsernamePassword=" + host);
+ if (TRACE) Log.d(LOGTAG, "setHttpAuthUsernamePassword=" + host);
mProvider.setHttpAuthUsernamePassword(host, realm, username, password);
}
@@ -697,7 +703,7 @@
*/
public void destroy() {
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "destroy");
+ if (TRACE) Log.d(LOGTAG, "destroy");
mProvider.destroy();
}
@@ -743,7 +749,7 @@
*/
public void setNetworkAvailable(boolean networkUp) {
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "setNetworkAvailable=" + networkUp);
+ if (TRACE) Log.d(LOGTAG, "setNetworkAvailable=" + networkUp);
mProvider.setNetworkAvailable(networkUp);
}
@@ -760,7 +766,7 @@
*/
public WebBackForwardList saveState(Bundle outState) {
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "saveState");
+ if (TRACE) Log.d(LOGTAG, "saveState");
return mProvider.saveState(outState);
}
@@ -777,7 +783,7 @@
@Deprecated
public boolean savePicture(Bundle b, final File dest) {
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "savePicture=" + dest.getName());
+ if (TRACE) Log.d(LOGTAG, "savePicture=" + dest.getName());
return mProvider.savePicture(b, dest);
}
@@ -795,7 +801,7 @@
@Deprecated
public boolean restorePicture(Bundle b, File src) {
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "restorePicture=" + src.getName());
+ if (TRACE) Log.d(LOGTAG, "restorePicture=" + src.getName());
return mProvider.restorePicture(b, src);
}
@@ -813,7 +819,7 @@
*/
public WebBackForwardList restoreState(Bundle inState) {
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "restoreState");
+ if (TRACE) Log.d(LOGTAG, "restoreState");
return mProvider.restoreState(inState);
}
@@ -830,7 +836,7 @@
*/
public void loadUrl(String url, Map<String, String> additionalHttpHeaders) {
checkThread();
- if (DebugFlags.TRACE_API) {
+ if (TRACE) {
StringBuilder headers = new StringBuilder();
if (additionalHttpHeaders != null) {
for (Map.Entry<String, String> entry : additionalHttpHeaders.entrySet()) {
@@ -849,7 +855,7 @@
*/
public void loadUrl(String url) {
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "loadUrl=" + url);
+ if (TRACE) Log.d(LOGTAG, "loadUrl=" + url);
mProvider.loadUrl(url);
}
@@ -864,7 +870,7 @@
*/
public void postUrl(String url, byte[] postData) {
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "postUrl=" + url);
+ if (TRACE) Log.d(LOGTAG, "postUrl=" + url);
if (URLUtil.isNetworkUrl(url)) {
mProvider.postUrl(url, postData);
} else {
@@ -903,7 +909,7 @@
*/
public void loadData(String data, String mimeType, String encoding) {
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "loadData");
+ if (TRACE) Log.d(LOGTAG, "loadData");
mProvider.loadData(data, mimeType, encoding);
}
@@ -936,7 +942,7 @@
public void loadDataWithBaseURL(String baseUrl, String data,
String mimeType, String encoding, String historyUrl) {
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "loadDataWithBaseURL=" + baseUrl);
+ if (TRACE) Log.d(LOGTAG, "loadDataWithBaseURL=" + baseUrl);
mProvider.loadDataWithBaseURL(baseUrl, data, mimeType, encoding, historyUrl);
}
@@ -953,7 +959,7 @@
*/
public void evaluateJavascript(String script, ValueCallback<String> resultCallback) {
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "evaluateJavascript=" + script);
+ if (TRACE) Log.d(LOGTAG, "evaluateJavascript=" + script);
mProvider.evaluateJavaScript(script, resultCallback);
}
@@ -964,7 +970,7 @@
*/
public void saveWebArchive(String filename) {
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "saveWebArchive=" + filename);
+ if (TRACE) Log.d(LOGTAG, "saveWebArchive=" + filename);
mProvider.saveWebArchive(filename);
}
@@ -982,7 +988,7 @@
*/
public void saveWebArchive(String basename, boolean autoname, ValueCallback<String> callback) {
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "saveWebArchive(auto)=" + basename);
+ if (TRACE) Log.d(LOGTAG, "saveWebArchive(auto)=" + basename);
mProvider.saveWebArchive(basename, autoname, callback);
}
@@ -991,7 +997,7 @@
*/
public void stopLoading() {
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "stopLoading");
+ if (TRACE) Log.d(LOGTAG, "stopLoading");
mProvider.stopLoading();
}
@@ -1000,7 +1006,7 @@
*/
public void reload() {
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "reload");
+ if (TRACE) Log.d(LOGTAG, "reload");
mProvider.reload();
}
@@ -1019,7 +1025,7 @@
*/
public void goBack() {
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "goBack");
+ if (TRACE) Log.d(LOGTAG, "goBack");
mProvider.goBack();
}
@@ -1038,7 +1044,7 @@
*/
public void goForward() {
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "goForward");
+ if (TRACE) Log.d(LOGTAG, "goForward");
mProvider.goForward();
}
@@ -1064,7 +1070,7 @@
*/
public void goBackOrForward(int steps) {
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "goBackOrForwad=" + steps);
+ if (TRACE) Log.d(LOGTAG, "goBackOrForwad=" + steps);
mProvider.goBackOrForward(steps);
}
@@ -1084,7 +1090,7 @@
*/
public boolean pageUp(boolean top) {
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "pageUp");
+ if (TRACE) Log.d(LOGTAG, "pageUp");
return mProvider.pageUp(top);
}
@@ -1096,7 +1102,7 @@
*/
public boolean pageDown(boolean bottom) {
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "pageDown");
+ if (TRACE) Log.d(LOGTAG, "pageDown");
return mProvider.pageDown(bottom);
}
@@ -1109,7 +1115,7 @@
@Deprecated
public void clearView() {
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "clearView");
+ if (TRACE) Log.d(LOGTAG, "clearView");
mProvider.clearView();
}
@@ -1140,7 +1146,7 @@
@Deprecated
public Picture capturePicture() {
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "capturePicture");
+ if (TRACE) Log.d(LOGTAG, "capturePicture");
return mProvider.capturePicture();
}
@@ -1151,7 +1157,7 @@
@Deprecated
public PrintDocumentAdapter createPrintDocumentAdapter() {
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "createPrintDocumentAdapter");
+ if (TRACE) Log.d(LOGTAG, "createPrintDocumentAdapter");
return mProvider.createPrintDocumentAdapter("default");
}
@@ -1170,7 +1176,7 @@
*/
public PrintDocumentAdapter createPrintDocumentAdapter(String documentName) {
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "createPrintDocumentAdapter");
+ if (TRACE) Log.d(LOGTAG, "createPrintDocumentAdapter");
return mProvider.createPrintDocumentAdapter(documentName);
}
@@ -1210,7 +1216,7 @@
*/
public void setInitialScale(int scaleInPercent) {
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "setInitialScale=" + scaleInPercent);
+ if (TRACE) Log.d(LOGTAG, "setInitialScale=" + scaleInPercent);
mProvider.setInitialScale(scaleInPercent);
}
@@ -1221,7 +1227,7 @@
*/
public void invokeZoomPicker() {
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "invokeZoomPicker");
+ if (TRACE) Log.d(LOGTAG, "invokeZoomPicker");
mProvider.invokeZoomPicker();
}
@@ -1245,7 +1251,7 @@
*/
public HitTestResult getHitTestResult() {
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "getHitTestResult");
+ if (TRACE) Log.d(LOGTAG, "getHitTestResult");
return mProvider.getHitTestResult();
}
@@ -1264,7 +1270,7 @@
*/
public void requestFocusNodeHref(Message hrefMsg) {
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "requestFocusNodeHref");
+ if (TRACE) Log.d(LOGTAG, "requestFocusNodeHref");
mProvider.requestFocusNodeHref(hrefMsg);
}
@@ -1277,7 +1283,7 @@
*/
public void requestImageRef(Message msg) {
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "requestImageRef");
+ if (TRACE) Log.d(LOGTAG, "requestImageRef");
mProvider.requestImageRef(msg);
}
@@ -1382,7 +1388,7 @@
*/
public void pauseTimers() {
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "pauseTimers");
+ if (TRACE) Log.d(LOGTAG, "pauseTimers");
mProvider.pauseTimers();
}
@@ -1392,7 +1398,7 @@
*/
public void resumeTimers() {
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "resumeTimers");
+ if (TRACE) Log.d(LOGTAG, "resumeTimers");
mProvider.resumeTimers();
}
@@ -1405,7 +1411,7 @@
*/
public void onPause() {
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "onPause");
+ if (TRACE) Log.d(LOGTAG, "onPause");
mProvider.onPause();
}
@@ -1414,7 +1420,7 @@
*/
public void onResume() {
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "onResume");
+ if (TRACE) Log.d(LOGTAG, "onResume");
mProvider.onResume();
}
@@ -1437,7 +1443,7 @@
@Deprecated
public void freeMemory() {
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "freeMemory");
+ if (TRACE) Log.d(LOGTAG, "freeMemory");
mProvider.freeMemory();
}
@@ -1449,7 +1455,7 @@
*/
public void clearCache(boolean includeDiskFiles) {
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "clearCache");
+ if (TRACE) Log.d(LOGTAG, "clearCache");
mProvider.clearCache(includeDiskFiles);
}
@@ -1461,7 +1467,7 @@
*/
public void clearFormData() {
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "clearFormData");
+ if (TRACE) Log.d(LOGTAG, "clearFormData");
mProvider.clearFormData();
}
@@ -1470,7 +1476,7 @@
*/
public void clearHistory() {
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "clearHistory");
+ if (TRACE) Log.d(LOGTAG, "clearHistory");
mProvider.clearHistory();
}
@@ -1480,7 +1486,7 @@
*/
public void clearSslPreferences() {
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "clearSslPreferences");
+ if (TRACE) Log.d(LOGTAG, "clearSslPreferences");
mProvider.clearSslPreferences();
}
@@ -1496,7 +1502,7 @@
* callback. The runnable will be called in UI thread.
*/
public static void clearClientCertPreferences(Runnable onCleared) {
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "clearClientCertPreferences");
+ if (TRACE) Log.d(LOGTAG, "clearClientCertPreferences");
getFactory().getStatics().clearClientCertPreferences(onCleared);
}
@@ -1538,7 +1544,7 @@
*/
public void findNext(boolean forward) {
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "findNext");
+ if (TRACE) Log.d(LOGTAG, "findNext");
mProvider.findNext(forward);
}
@@ -1554,7 +1560,7 @@
@Deprecated
public int findAll(String find) {
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "findAll");
+ if (TRACE) Log.d(LOGTAG, "findAll");
StrictMode.noteSlowCall("findAll blocks UI: prefer findAllAsync");
return mProvider.findAll(find);
}
@@ -1569,7 +1575,7 @@
*/
public void findAllAsync(String find) {
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "findAllAsync");
+ if (TRACE) Log.d(LOGTAG, "findAllAsync");
mProvider.findAllAsync(find);
}
@@ -1590,7 +1596,7 @@
@Deprecated
public boolean showFindDialog(String text, boolean showIme) {
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "showFindDialog");
+ if (TRACE) Log.d(LOGTAG, "showFindDialog");
return mProvider.showFindDialog(text, showIme);
}
@@ -1646,7 +1652,7 @@
*/
public void clearMatches() {
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "clearMatches");
+ if (TRACE) Log.d(LOGTAG, "clearMatches");
mProvider.clearMatches();
}
@@ -1707,7 +1713,7 @@
@Deprecated
public void setPictureListener(PictureListener listener) {
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "setPictureListener=" + listener);
+ if (TRACE) Log.d(LOGTAG, "setPictureListener=" + listener);
mProvider.setPictureListener(listener);
}
@@ -1764,7 +1770,7 @@
*/
public void addJavascriptInterface(Object object, String name) {
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "addJavascriptInterface=" + name);
+ if (TRACE) Log.d(LOGTAG, "addJavascriptInterface=" + name);
mProvider.addJavascriptInterface(object, name);
}
@@ -1777,7 +1783,7 @@
*/
public void removeJavascriptInterface(String name) {
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "removeJavascriptInterface=" + name);
+ if (TRACE) Log.d(LOGTAG, "removeJavascriptInterface=" + name);
mProvider.removeJavascriptInterface(name);
}
@@ -1881,7 +1887,7 @@
public void flingScroll(int vx, int vy) {
checkThread();
- if (DebugFlags.TRACE_API) Log.d(LOGTAG, "flingScroll");
+ if (TRACE) Log.d(LOGTAG, "flingScroll");
mProvider.flingScroll(vx, vy);
}
@@ -2006,6 +2012,7 @@
*
* @hide WebViewProvider is not public API.
*/
+ @SystemApi
public WebViewProvider getWebViewProvider() {
return mProvider;
}
@@ -2015,6 +2022,7 @@
* and fields, and make super-class calls in this WebView instance.
* @hide Only for use by WebViewProvider implementations
*/
+ @SystemApi
public class PrivateAccess {
// ---- Access to super-class methods ----
public int super_getScrollBarStyle() {
diff --git a/core/java/android/webkit/WebViewDatabase.java b/core/java/android/webkit/WebViewDatabase.java
index 99e0ffb..bfea481 100644
--- a/core/java/android/webkit/WebViewDatabase.java
+++ b/core/java/android/webkit/WebViewDatabase.java
@@ -16,6 +16,7 @@
package android.webkit;
+import android.annotation.SystemApi;
import android.content.Context;
/**
@@ -28,18 +29,12 @@
* <li>Data entered into text fields (e.g. for autocomplete suggestions)</li>
* </ul>
*/
-public class WebViewDatabase {
+public abstract class WebViewDatabase {
/**
* @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1}
*/
protected static final String LOGTAG = "webviewdatabase";
- /**
- * @hide Only for use by WebViewProvider implementations.
- */
- protected WebViewDatabase() {
- }
-
public static WebViewDatabase getInstance(Context context) {
return WebViewFactory.getProvider().getWebViewDatabase(context);
}
@@ -54,9 +49,7 @@
* @deprecated Saving passwords in WebView will not be supported in future versions.
*/
@Deprecated
- public boolean hasUsernamePassword() {
- throw new MustOverrideException();
- }
+ public abstract boolean hasUsernamePassword();
/**
* Clears any saved username/password pairs for web forms.
@@ -67,9 +60,7 @@
* @deprecated Saving passwords in WebView will not be supported in future versions.
*/
@Deprecated
- public void clearUsernamePassword() {
- throw new MustOverrideException();
- }
+ public abstract void clearUsernamePassword();
/**
* Gets whether there are any saved credentials for HTTP authentication.
@@ -79,9 +70,7 @@
* @see WebView#setHttpAuthUsernamePassword
* @see #clearHttpAuthUsernamePassword
*/
- public boolean hasHttpAuthUsernamePassword() {
- throw new MustOverrideException();
- }
+ public abstract boolean hasHttpAuthUsernamePassword();
/**
* Clears any saved credentials for HTTP authentication.
@@ -90,9 +79,7 @@
* @see WebView#setHttpAuthUsernamePassword
* @see #hasHttpAuthUsernamePassword
*/
- public void clearHttpAuthUsernamePassword() {
- throw new MustOverrideException();
- }
+ public abstract void clearHttpAuthUsernamePassword();
/**
* Gets whether there is any saved data for web forms.
@@ -100,16 +87,12 @@
* @return whether there is any saved data for web forms
* @see #clearFormData
*/
- public boolean hasFormData() {
- throw new MustOverrideException();
- }
+ public abstract boolean hasFormData();
/**
* Clears any saved data for web forms.
*
* @see #hasFormData
*/
- public void clearFormData() {
- throw new MustOverrideException();
- }
+ public abstract void clearFormData();
}
diff --git a/core/java/android/webkit/WebViewDelegate.java b/core/java/android/webkit/WebViewDelegate.java
index c878b3d..3dcfda3 100644
--- a/core/java/android/webkit/WebViewDelegate.java
+++ b/core/java/android/webkit/WebViewDelegate.java
@@ -16,6 +16,7 @@
package android.webkit;
+import android.annotation.SystemApi;
import android.app.ActivityThread;
import android.app.Application;
import android.content.Context;
@@ -35,6 +36,7 @@
*
* @hide
*/
+@SystemApi
public final class WebViewDelegate {
/* package */ WebViewDelegate() { }
diff --git a/core/java/android/webkit/WebViewFactory.java b/core/java/android/webkit/WebViewFactory.java
index ca9f378..7b23d8f 100644
--- a/core/java/android/webkit/WebViewFactory.java
+++ b/core/java/android/webkit/WebViewFactory.java
@@ -16,6 +16,7 @@
package android.webkit;
+import android.annotation.SystemApi;
import android.app.ActivityManagerInternal;
import android.app.Application;
import android.app.AppGlobals;
@@ -46,6 +47,7 @@
*
* @hide
*/
+@SystemApi
public final class WebViewFactory {
private static final String CHROMIUM_WEBVIEW_FACTORY =
diff --git a/core/java/android/webkit/WebViewFactoryProvider.java b/core/java/android/webkit/WebViewFactoryProvider.java
index d37d217..9105394 100644
--- a/core/java/android/webkit/WebViewFactoryProvider.java
+++ b/core/java/android/webkit/WebViewFactoryProvider.java
@@ -16,6 +16,7 @@
package android.webkit;
+import android.annotation.SystemApi;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
@@ -26,6 +27,7 @@
* implementation of this interface, and make it available to the WebView via mechanism TBD.
* @hide
*/
+@SystemApi
public interface WebViewFactoryProvider {
/**
* This Interface provides glue for implementing the backend of WebView static methods which
diff --git a/core/java/android/webkit/WebViewProvider.java b/core/java/android/webkit/WebViewProvider.java
index fe18138..2aee57b 100644
--- a/core/java/android/webkit/WebViewProvider.java
+++ b/core/java/android/webkit/WebViewProvider.java
@@ -16,6 +16,7 @@
package android.webkit;
+import android.annotation.SystemApi;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.Canvas;
@@ -53,6 +54,7 @@
*
* @hide Not part of the public API; only required by system implementors.
*/
+@SystemApi
public interface WebViewProvider {
//-------------------------------------------------------------------------
// Main interface for backend provider of the WebView class.
diff --git a/media/java/android/media/AudioManager.java b/media/java/android/media/AudioManager.java
index 8fc0b8e..645681a 100644
--- a/media/java/android/media/AudioManager.java
+++ b/media/java/android/media/AudioManager.java
@@ -2201,6 +2201,8 @@
listener = findFocusListener((String)msg.obj);
}
if (listener != null) {
+ Log.d(TAG, "AudioManager dispatching onAudioFocusChange("
+ + msg.what + ") for " + msg.obj);
listener.onAudioFocusChange(msg.what);
}
}
@@ -2270,6 +2272,14 @@
* A successful focus change request.
*/
public static final int AUDIOFOCUS_REQUEST_GRANTED = 1;
+ /**
+ * @hide
+ * A focus change request whose granting is delayed: the request was successful, but the
+ * requester will only be granted audio focus once the condition that prevented immediate
+ * granting has ended.
+ * See {@link #requestAudioFocus(OnAudioFocusChangeListener, AudioAttributes, int, int)}
+ */
+ public static final int AUDIOFOCUS_REQUEST_DELAYED = 2;
/**
@@ -2291,18 +2301,87 @@
*/
public int requestAudioFocus(OnAudioFocusChangeListener l, int streamType, int durationHint) {
int status = AUDIOFOCUS_REQUEST_FAILED;
+
+ try {
+ // status is guaranteed to be either AUDIOFOCUS_REQUEST_FAILED or
+ // AUDIOFOCUS_REQUEST_GRANTED as focus is requested without the
+ // AUDIOFOCUS_FLAG_DELAY_OK flag
+ status = requestAudioFocus(l,
+ new AudioAttributes.Builder()
+ .setInternalLegacyStreamType(streamType).build(),
+ durationHint,
+ 0 /* flags, legacy behavior */);
+ } catch (IllegalArgumentException e) {
+ Log.e(TAG, "Audio focus request denied due to ", e);
+ }
+
+ return status;
+ }
+
+ // when adding new flags, add them to AUDIOFOCUS_FLAGS_ALL
+ /** @hide */
+ public static final int AUDIOFOCUS_FLAG_DELAY_OK = 0x1 << 0;
+ /** @hide */
+ public static final int AUDIOFOCUS_FLAGS_ALL = AUDIOFOCUS_FLAG_DELAY_OK;
+
+ /**
+ * @hide
+ * @param l the listener to be notified of audio focus changes. It is not allowed to be null
+ * when the request is flagged with {@link #AUDIOFOCUS_FLAG_DELAY_OK}.
+ * @param requestAttributes non null {@link AudioAttributes} describing the main reason for
+ * requesting audio focus.
+ * @param durationHint use {@link #AUDIOFOCUS_GAIN_TRANSIENT} to indicate this focus request
+ * is temporary, and focus will be abandonned shortly. Examples of transient requests are
+ * for the playback of driving directions, or notifications sounds.
+ * Use {@link #AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK} to indicate also that it's ok for
+ * the previous focus owner to keep playing if it ducks its audio output.
+ * Alternatively use {@link #AUDIOFOCUS_GAIN_TRANSIENT_EXCLUSIVE} for a temporary request
+ * that benefits from the system not playing disruptive sounds like notifications, for
+ * usecases such as voice memo recording, or speech recognition.
+ * Use {@link #AUDIOFOCUS_GAIN} for a focus request of unknown duration such
+ * as the playback of a song or a video.
+ * @param flags use 0 when not using any flags for the request, which behaves like
+ * {@link #requestAudioFocus(OnAudioFocusChangeListener, int, int)}, where either audio
+ * focus is granted immediately, or the grant request fails because the system is in a
+ * state where focus cannot change (e.g. a phone call).
+ * Use {link #AUDIOFOCUS_FLAG_DELAY_OK} if it is ok for the requester to not be granted
+ * audio focus immediately (as indicated by {@link #AUDIOFOCUS_REQUEST_DELAYED}) when
+ * the system is in a state where focus cannot change, but be granted focus later when
+ * this condition ends.
+ * @return {@link #AUDIOFOCUS_REQUEST_FAILED}, {@link #AUDIOFOCUS_REQUEST_GRANTED}
+ * or {@link #AUDIOFOCUS_REQUEST_DELAYED}.
+ * The return value is never {@link #AUDIOFOCUS_REQUEST_DELAYED} when focus is requested
+ * without the {@link #AUDIOFOCUS_FLAG_DELAY_OK} flag.
+ * @throws IllegalArgumentException
+ */
+ public int requestAudioFocus(OnAudioFocusChangeListener l,
+ AudioAttributes requestAttributes,
+ int durationHint,
+ int flags) throws IllegalArgumentException {
+ // parameter checking
+ if (requestAttributes == null) {
+ throw new IllegalArgumentException("Illegal null AudioAttributes argument");
+ }
if ((durationHint < AUDIOFOCUS_GAIN) ||
(durationHint > AUDIOFOCUS_GAIN_TRANSIENT_EXCLUSIVE)) {
- Log.e(TAG, "Invalid duration hint, audio focus request denied");
- return status;
+ throw new IllegalArgumentException("Invalid duration hint");
}
+ if (flags != (flags & AUDIOFOCUS_FLAGS_ALL)) {
+ throw new IllegalArgumentException("Illegal flags 0x"
+ + Integer.toHexString(flags).toUpperCase());
+ }
+ if (((flags & AUDIOFOCUS_FLAG_DELAY_OK) == AUDIOFOCUS_FLAG_DELAY_OK) && (l == null)) {
+ throw new IllegalArgumentException(
+ "Illegal null focus listener when flagged as accepting delayed focus grant");
+ }
+
+ int status = AUDIOFOCUS_REQUEST_FAILED;
registerAudioFocusListener(l);
- //TODO protect request by permission check?
IAudioService service = getService();
try {
- status = service.requestAudioFocus(streamType, durationHint, mICallBack,
+ status = service.requestAudioFocus(requestAttributes, durationHint, mICallBack,
mAudioFocusDispatcher, getIdForAudioFocusListener(l),
- mContext.getOpPackageName() /* package name */);
+ mContext.getOpPackageName() /* package name */, flags);
} catch (RemoteException e) {
Log.e(TAG, "Can't call requestAudioFocus() on AudioService due to "+e);
}
@@ -2322,9 +2401,11 @@
public void requestAudioFocusForCall(int streamType, int durationHint) {
IAudioService service = getService();
try {
- service.requestAudioFocus(streamType, durationHint, mICallBack, null,
+ service.requestAudioFocus(new AudioAttributes.Builder()
+ .setInternalLegacyStreamType(streamType).build(),
+ durationHint, mICallBack, null,
MediaFocusControl.IN_VOICE_COMM_FOCUS_ID,
- mContext.getOpPackageName());
+ mContext.getOpPackageName(), 0 /* flags, legacy behavior*/ );
} catch (RemoteException e) {
Log.e(TAG, "Can't call requestAudioFocusForCall() on AudioService due to "+e);
}
diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java
index 29d4930..a80b356 100644
--- a/media/java/android/media/AudioService.java
+++ b/media/java/android/media/AudioService.java
@@ -5011,10 +5011,10 @@
//==========================================================================================
// Audio Focus
//==========================================================================================
- public int requestAudioFocus(int mainStreamType, int durationHint, IBinder cb,
- IAudioFocusDispatcher fd, String clientId, String callingPackageName) {
- return mMediaFocusControl.requestAudioFocus(mainStreamType, durationHint, cb, fd,
- clientId, callingPackageName);
+ public int requestAudioFocus(AudioAttributes aa, int durationHint, IBinder cb,
+ IAudioFocusDispatcher fd, String clientId, String callingPackageName, int flags) {
+ return mMediaFocusControl.requestAudioFocus(aa, durationHint, cb, fd,
+ clientId, callingPackageName, flags);
}
public int abandonAudioFocus(IAudioFocusDispatcher fd, String clientId) {
diff --git a/media/java/android/media/FocusRequester.java b/media/java/android/media/FocusRequester.java
index 9a39994..682d54c 100644
--- a/media/java/android/media/FocusRequester.java
+++ b/media/java/android/media/FocusRequester.java
@@ -45,19 +45,24 @@
*/
private final int mFocusGainRequest;
/**
+ * the flags associated with the gain request that qualify the type of grant (e.g. accepting
+ * delay vs grant must be immediate)
+ */
+ private final int mGrantFlags;
+ /**
* the audio focus loss received my mFocusDispatcher, is AudioManager.AUDIOFOCUS_NONE if
* it never lost focus.
*/
private int mFocusLossReceived;
/**
- * the stream type associated with the focus request
+ * the audio attributes associated with the focus request
*/
- private final int mStreamType;
+ private final AudioAttributes mAttributes;
- FocusRequester(int streamType, int focusRequest,
+ FocusRequester(AudioAttributes aa, int focusRequest, int grantFlags,
IAudioFocusDispatcher afl, IBinder source, String id, AudioFocusDeathHandler hdlr,
String pn, int uid) {
- mStreamType = streamType;
+ mAttributes = aa;
mFocusDispatcher = afl;
mSourceRef = source;
mClientId = id;
@@ -65,6 +70,7 @@
mPackageName = pn;
mCallingUid = uid;
mFocusGainRequest = focusRequest;
+ mGrantFlags = grantFlags;
mFocusLossReceived = AudioManager.AUDIOFOCUS_NONE;
}
@@ -98,8 +104,12 @@
return mFocusGainRequest;
}
- int getStreamType() {
- return mStreamType;
+ int getGrantFlags() {
+ return mGrantFlags;
+ }
+
+ AudioAttributes getAudioAttributes() {
+ return mAttributes;
}
@@ -139,9 +149,10 @@
+ " -- pack: " + mPackageName
+ " -- client: " + mClientId
+ " -- gain: " + focusGainToString()
+ + " -- grant: " + mGrantFlags
+ " -- loss: " + focusLossToString()
+ " -- uid: " + mCallingUid
- + " -- stream: " + mStreamType);
+ + " -- attr: " + mAttributes);
}
diff --git a/media/java/android/media/IAudioService.aidl b/media/java/android/media/IAudioService.aidl
index 317cc21..47a5291 100644
--- a/media/java/android/media/IAudioService.aidl
+++ b/media/java/android/media/IAudioService.aidl
@@ -19,6 +19,7 @@
import android.app.PendingIntent;
import android.bluetooth.BluetoothDevice;
import android.content.ComponentName;
+import android.media.AudioAttributes;
import android.media.AudioRoutesInfo;
import android.media.IAudioFocusDispatcher;
import android.media.IAudioRoutesObserver;
@@ -116,8 +117,8 @@
boolean isBluetoothA2dpOn();
- int requestAudioFocus(int mainStreamType, int durationHint, IBinder cb,
- IAudioFocusDispatcher fd, String clientId, String callingPackageName);
+ int requestAudioFocus(in AudioAttributes aa, int durationHint, IBinder cb,
+ IAudioFocusDispatcher fd, String clientId, String callingPackageName, int flags);
int abandonAudioFocus(IAudioFocusDispatcher fd, String clientId);
diff --git a/media/java/android/media/MediaFocusControl.java b/media/java/android/media/MediaFocusControl.java
index c67e397..c495106 100644
--- a/media/java/android/media/MediaFocusControl.java
+++ b/media/java/android/media/MediaFocusControl.java
@@ -538,16 +538,54 @@
/**
* Helper function:
* Returns true if the system is in a state where the focus can be reevaluated, false otherwise.
+ * The implementation guarantees that a state where focus cannot be immediately reassigned
+ * implies that an "exclusive" focus owner is at the top of the focus stack.
+ * Modifications to the implementation that break this assumption will cause focus requests to
+ * misbehave when honoring the AudioManager.AUDIOFOCUS_FLAG_DELAY_OK flag.
*/
private boolean canReassignAudioFocus() {
// focus requests are rejected during a phone call or when the phone is ringing
// this is equivalent to IN_VOICE_COMM_FOCUS_ID having the focus
- if (!mFocusStack.isEmpty() && mFocusStack.peek().hasSameClient(IN_VOICE_COMM_FOCUS_ID)) {
+ if (!mFocusStack.isEmpty() && isExclusiveFocusOwner(mFocusStack.peek())) {
return false;
}
return true;
}
+ private boolean isExclusiveFocusOwner(FocusRequester fr) {
+ return fr.hasSameClient(IN_VOICE_COMM_FOCUS_ID);
+ }
+
+ /**
+ * Helper function
+ * Pre-conditions: focus stack is not empty, there is one or more exclusive focus owner
+ * at the top of the focus stack
+ * Push the focus requester onto the audio focus stack at the first position immediately
+ * following the exclusive focus owners.
+ * @return {@link AudioManager#AUDIOFOCUS_REQUEST_GRANTED} or
+ * {@link AudioManager#AUDIOFOCUS_REQUEST_DELAYED}
+ */
+ private int pushBelowExclusiveFocusOwners(FocusRequester nfr) {
+ int lastExclusiveFocusOwnerIndex = mFocusStack.size();
+ for (int index = mFocusStack.size()-1; index >= 0; index--) {
+ if (isExclusiveFocusOwner(mFocusStack.elementAt(index))) {
+ lastExclusiveFocusOwnerIndex = index;
+ }
+ }
+ if (lastExclusiveFocusOwnerIndex == mFocusStack.size()) {
+ // this should not happen, but handle it and log an error
+ Log.e(TAG, "No exclusive focus owner found in propagateFocusLossFromGain_syncAf()",
+ new Exception());
+ // no exclusive owner, push at top of stack, focus is granted, propagate change
+ propagateFocusLossFromGain_syncAf(nfr.getGainRequest());
+ mFocusStack.push(nfr);
+ return AudioManager.AUDIOFOCUS_REQUEST_GRANTED;
+ } else {
+ mFocusStack.insertElementAt(nfr, lastExclusiveFocusOwnerIndex);
+ return AudioManager.AUDIOFOCUS_REQUEST_DELAYED;
+ }
+ }
+
/**
* Inner class to monitor audio focus client deaths, and remove them from the audio focus
* stack if necessary.
@@ -581,10 +619,11 @@
}
}
- /** @see AudioManager#requestAudioFocus(AudioManager.OnAudioFocusChangeListener, int, int) */
- protected int requestAudioFocus(int mainStreamType, int focusChangeHint, IBinder cb,
- IAudioFocusDispatcher fd, String clientId, String callingPackageName) {
- Log.i(TAG, " AudioFocus requestAudioFocus() from " + clientId);
+ /** @see AudioManager#requestAudioFocus(AudioManager.OnAudioFocusChangeListener, int, int, int) */
+ protected int requestAudioFocus(AudioAttributes aa, int focusChangeHint, IBinder cb,
+ IAudioFocusDispatcher fd, String clientId, String callingPackageName, int flags) {
+ Log.i(TAG, " AudioFocus requestAudioFocus() from " + clientId + " req=" + focusChangeHint +
+ "flags=0x" + Integer.toHexString(flags));
// we need a valid binder callback for clients
if (!cb.pingBinder()) {
Log.e(TAG, " AudioFocus DOA client for requestAudioFocus(), aborting.");
@@ -597,8 +636,16 @@
}
synchronized(mAudioFocusLock) {
+ boolean focusGrantDelayed = false;
if (!canReassignAudioFocus()) {
- return AudioManager.AUDIOFOCUS_REQUEST_FAILED;
+ if ((flags & AudioManager.AUDIOFOCUS_FLAG_DELAY_OK) == 0) {
+ return AudioManager.AUDIOFOCUS_REQUEST_FAILED;
+ } else {
+ // request has AUDIOFOCUS_FLAG_DELAY_OK: focus can't be
+ // granted right now, so the requester will be inserted in the focus stack
+ // to receive focus later
+ focusGrantDelayed = true;
+ }
}
// handle the potential premature death of the new holder of the focus
@@ -616,7 +663,8 @@
if (!mFocusStack.empty() && mFocusStack.peek().hasSameClient(clientId)) {
// if focus is already owned by this client and the reason for acquiring the focus
// hasn't changed, don't do anything
- if (mFocusStack.peek().getGainRequest() == focusChangeHint) {
+ final FocusRequester fr = mFocusStack.peek();
+ if (fr.getGainRequest() == focusChangeHint && fr.getGrantFlags() == flags) {
// unlink death handler so it can be gc'ed.
// linkToDeath() creates a JNI global reference preventing collection.
cb.unlinkToDeath(afdh, 0);
@@ -624,21 +672,31 @@
}
// the reason for the audio focus request has changed: remove the current top of
// stack and respond as if we had a new focus owner
- FocusRequester fr = mFocusStack.pop();
- fr.release();
+ if (!focusGrantDelayed) {
+ mFocusStack.pop();
+ // the entry that was "popped" is the same that was "peeked" above
+ fr.release();
+ }
}
// focus requester might already be somewhere below in the stack, remove it
removeFocusStackEntry(clientId, false /* signal */);
- // propagate the focus change through the stack
- if (!mFocusStack.empty()) {
- propagateFocusLossFromGain_syncAf(focusChangeHint);
- }
+ final FocusRequester nfr = new FocusRequester(aa, focusChangeHint, flags, fd, cb,
+ clientId, afdh, callingPackageName, Binder.getCallingUid());
+ if (focusGrantDelayed) {
+ // focusGrantDelayed being true implies we can't reassign focus right now
+ // which implies the focus stack is not empty.
+ return pushBelowExclusiveFocusOwners(nfr);
+ } else {
+ // propagate the focus change through the stack
+ if (!mFocusStack.empty()) {
+ propagateFocusLossFromGain_syncAf(focusChangeHint);
+ }
- // push focus requester at the top of the audio focus stack
- mFocusStack.push(new FocusRequester(mainStreamType, focusChangeHint, fd, cb,
- clientId, afdh, callingPackageName, Binder.getCallingUid()));
+ // push focus requester at the top of the audio focus stack
+ mFocusStack.push(nfr);
+ }
}//synchronized(mAudioFocusLock)
diff --git a/media/jni/android_mtp_MtpDatabase.cpp b/media/jni/android_mtp_MtpDatabase.cpp
index 62b4a36..b8e850a 100644
--- a/media/jni/android_mtp_MtpDatabase.cpp
+++ b/media/jni/android_mtp_MtpDatabase.cpp
@@ -469,6 +469,63 @@
return result;
}
+static bool readLongValue(int type, MtpDataPacket& packet, jlong& longValue) {
+ switch (type) {
+ case MTP_TYPE_INT8: {
+ int8_t temp;
+ if (!packet.getInt8(temp)) return false;
+ longValue = temp;
+ break;
+ }
+ case MTP_TYPE_UINT8: {
+ uint8_t temp;
+ if (!packet.getUInt8(temp)) return false;
+ longValue = temp;
+ break;
+ }
+ case MTP_TYPE_INT16: {
+ int16_t temp;
+ if (!packet.getInt16(temp)) return false;
+ longValue = temp;
+ break;
+ }
+ case MTP_TYPE_UINT16: {
+ uint16_t temp;
+ if (!packet.getUInt16(temp)) return false;
+ longValue = temp;
+ break;
+ }
+ case MTP_TYPE_INT32: {
+ int32_t temp;
+ if (!packet.getInt32(temp)) return false;
+ longValue = temp;
+ break;
+ }
+ case MTP_TYPE_UINT32: {
+ uint32_t temp;
+ if (!packet.getUInt32(temp)) return false;
+ longValue = temp;
+ break;
+ }
+ case MTP_TYPE_INT64: {
+ int64_t temp;
+ if (!packet.getInt64(temp)) return false;
+ longValue = temp;
+ break;
+ }
+ case MTP_TYPE_UINT64: {
+ uint64_t temp;
+ if (!packet.getUInt64(temp)) return false;
+ longValue = temp;
+ break;
+ }
+ default:
+ ALOGE("unsupported type in readLongValue");
+ return false;
+ }
+ return true;
+}
+
MtpResponseCode MyMtpDatabase::setObjectPropertyValue(MtpObjectHandle handle,
MtpObjectProperty property,
MtpDataPacket& packet) {
@@ -480,49 +537,22 @@
JNIEnv* env = AndroidRuntime::getJNIEnv();
jlong longValue = 0;
jstring stringValue = NULL;
+ MtpResponseCode result = MTP_RESPONSE_INVALID_OBJECT_PROP_FORMAT;
- switch (type) {
- case MTP_TYPE_INT8:
- longValue = packet.getInt8();
- break;
- case MTP_TYPE_UINT8:
- longValue = packet.getUInt8();
- break;
- case MTP_TYPE_INT16:
- longValue = packet.getInt16();
- break;
- case MTP_TYPE_UINT16:
- longValue = packet.getUInt16();
- break;
- case MTP_TYPE_INT32:
- longValue = packet.getInt32();
- break;
- case MTP_TYPE_UINT32:
- longValue = packet.getUInt32();
- break;
- case MTP_TYPE_INT64:
- longValue = packet.getInt64();
- break;
- case MTP_TYPE_UINT64:
- longValue = packet.getUInt64();
- break;
- case MTP_TYPE_STR:
- {
- MtpStringBuffer buffer;
- packet.getString(buffer);
- stringValue = env->NewStringUTF((const char *)buffer);
- break;
- }
- default:
- ALOGE("unsupported type in setObjectPropertyValue\n");
- return MTP_RESPONSE_INVALID_OBJECT_PROP_FORMAT;
+ if (type == MTP_TYPE_STR) {
+ MtpStringBuffer buffer;
+ if (!packet.getString(buffer)) goto fail;
+ stringValue = env->NewStringUTF((const char *)buffer);
+ } else {
+ if (!readLongValue(type, packet, longValue)) goto fail;
}
- jint result = env->CallIntMethod(mDatabase, method_setObjectProperty,
+ result = env->CallIntMethod(mDatabase, method_setObjectProperty,
(jint)handle, (jint)property, longValue, stringValue);
if (stringValue)
env->DeleteLocalRef(stringValue);
+fail:
checkAndClearExceptionFromCallback(env, __FUNCTION__);
return result;
}
@@ -610,49 +640,22 @@
JNIEnv* env = AndroidRuntime::getJNIEnv();
jlong longValue = 0;
jstring stringValue = NULL;
+ MtpResponseCode result = MTP_RESPONSE_INVALID_DEVICE_PROP_FORMAT;
- switch (type) {
- case MTP_TYPE_INT8:
- longValue = packet.getInt8();
- break;
- case MTP_TYPE_UINT8:
- longValue = packet.getUInt8();
- break;
- case MTP_TYPE_INT16:
- longValue = packet.getInt16();
- break;
- case MTP_TYPE_UINT16:
- longValue = packet.getUInt16();
- break;
- case MTP_TYPE_INT32:
- longValue = packet.getInt32();
- break;
- case MTP_TYPE_UINT32:
- longValue = packet.getUInt32();
- break;
- case MTP_TYPE_INT64:
- longValue = packet.getInt64();
- break;
- case MTP_TYPE_UINT64:
- longValue = packet.getUInt64();
- break;
- case MTP_TYPE_STR:
- {
- MtpStringBuffer buffer;
- packet.getString(buffer);
- stringValue = env->NewStringUTF((const char *)buffer);
- break;
- }
- default:
- ALOGE("unsupported type in setDevicePropertyValue\n");
- return MTP_RESPONSE_INVALID_OBJECT_PROP_FORMAT;
+ if (type == MTP_TYPE_STR) {
+ MtpStringBuffer buffer;
+ if (!packet.getString(buffer)) goto fail;
+ stringValue = env->NewStringUTF((const char *)buffer);
+ } else {
+ if (!readLongValue(type, packet, longValue)) goto fail;
}
- jint result = env->CallIntMethod(mDatabase, method_setDeviceProperty,
+ result = env->CallIntMethod(mDatabase, method_setDeviceProperty,
(jint)property, longValue, stringValue);
if (stringValue)
env->DeleteLocalRef(stringValue);
+fail:
checkAndClearExceptionFromCallback(env, __FUNCTION__);
return result;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeScrimController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeScrimController.java
new file mode 100644
index 0000000..c0d7b9b
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeScrimController.java
@@ -0,0 +1,260 @@
+/*
+ * Copyright (C) 2014 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 com.android.systemui.statusbar.phone;
+
+import android.animation.Animator;
+import android.animation.AnimatorListenerAdapter;
+import android.animation.ValueAnimator;
+import android.annotation.NonNull;
+import android.content.Context;
+import android.graphics.Color;
+import android.os.Handler;
+import android.util.Log;
+import android.view.animation.Animation;
+import android.view.animation.AnimationUtils;
+import android.view.animation.Interpolator;
+
+import com.android.systemui.doze.DozeHost;
+import com.android.systemui.doze.DozeLog;
+
+/**
+ * Controller which handles all the doze animations of the scrims.
+ */
+public class DozeScrimController {
+ private static final String TAG = "DozeScrimController";
+ private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
+
+ private final DozeParameters mDozeParameters;
+ private final Interpolator mPulseInInterpolator = PhoneStatusBar.ALPHA_OUT;
+ private final Interpolator mPulseOutInterpolator = PhoneStatusBar.ALPHA_IN;
+ private final Interpolator mDozeAnimationInterpolator;
+ private final Handler mHandler = new Handler();
+ private final ScrimController mScrimController;
+
+ private boolean mDozing;
+ private DozeHost.PulseCallback mPulseCallback;
+ private Animator mInFrontAnimator;
+ private Animator mBehindAnimator;
+ private float mInFrontTarget;
+ private float mBehindTarget;
+
+ public DozeScrimController(ScrimController scrimController, Context context) {
+ mScrimController = scrimController;
+ mDozeParameters = new DozeParameters(context);
+ mDozeAnimationInterpolator = AnimationUtils.loadInterpolator(context,
+ android.R.interpolator.linear_out_slow_in);
+ }
+
+ public void setDozing(boolean dozing, boolean animate) {
+ if (mDozing == dozing) return;
+ mDozing = dozing;
+ if (mDozing) {
+ abortAnimations();
+ mScrimController.setDozeBehindAlpha(1f);
+ mScrimController.setDozeInFrontAlpha(1f);
+ } else {
+ cancelPulsing();
+ if (animate) {
+ startScrimAnimation(false /* inFront */, 0f /* target */,
+ NotificationPanelView.DOZE_ANIMATION_DURATION, mDozeAnimationInterpolator);
+ startScrimAnimation(true /* inFront */, 0f /* target */,
+ NotificationPanelView.DOZE_ANIMATION_DURATION, mDozeAnimationInterpolator);
+ } else {
+ abortAnimations();
+ mScrimController.setDozeBehindAlpha(0f);
+ mScrimController.setDozeInFrontAlpha(0f);
+ }
+ }
+ }
+
+ /** When dozing, fade screen contents in and out using the front scrim. */
+ public void pulse(@NonNull DozeHost.PulseCallback callback) {
+ if (callback == null) {
+ throw new IllegalArgumentException("callback must not be null");
+ }
+
+ if (!mDozing || mPulseCallback != null) {
+ // Pulse suppressed.
+ callback.onPulseFinished();
+ return;
+ }
+
+ // Begin pulse. Note that it's very important that the pulse finished callback
+ // be invoked when we're done so that the caller can drop the pulse wakelock.
+ mPulseCallback = callback;
+ mHandler.post(mPulseIn);
+ }
+
+ public boolean isPulsing() {
+ return mPulseCallback != null;
+ }
+
+ private void cancelPulsing() {
+ if (DEBUG) Log.d(TAG, "Cancel pulsing");
+
+ if (mPulseCallback != null) {
+ mHandler.removeCallbacks(mPulseIn);
+ mHandler.removeCallbacks(mPulseOut);
+ pulseFinished();
+ }
+ }
+
+ private void pulseStarted() {
+ if (mPulseCallback != null) {
+ mPulseCallback.onPulseStarted();
+ }
+ }
+
+ private void pulseFinished() {
+ if (mPulseCallback != null) {
+ mPulseCallback.onPulseFinished();
+ mPulseCallback = null;
+ }
+ }
+
+ private void abortAnimations() {
+ if (mInFrontAnimator != null) {
+ mInFrontAnimator.cancel();
+ }
+ if (mBehindAnimator != null) {
+ mBehindAnimator.cancel();
+ }
+ }
+
+ private void startScrimAnimation(final boolean inFront, float target, long duration,
+ Interpolator interpolator) {
+ startScrimAnimation(inFront, target, duration, interpolator, 0 /* delay */,
+ null /* endRunnable */);
+ }
+
+ private void startScrimAnimation(final boolean inFront, float target, long duration,
+ Interpolator interpolator, long delay, final Runnable endRunnable) {
+ Animator current = getCurrentAnimator(inFront);
+ if (current != null) {
+ float currentTarget = getCurrentTarget(inFront);
+ if (currentTarget == target) {
+ return;
+ }
+ current.cancel();
+ }
+ ValueAnimator anim = ValueAnimator.ofFloat(getDozeAlpha(inFront), target);
+ anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
+ @Override
+ public void onAnimationUpdate(ValueAnimator animation) {
+ float value = (float) animation.getAnimatedValue();
+ setDozeAlpha(inFront, value);
+ }
+ });
+ anim.setInterpolator(interpolator);
+ anim.setDuration(duration);
+ anim.setStartDelay(delay);
+ anim.addListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ setCurrentAnimator(inFront, null);
+ if (endRunnable != null) {
+ endRunnable.run();
+ }
+ }
+ });
+ anim.start();
+ setCurrentAnimator(inFront, anim);
+ setCurrentTarget(inFront, target);
+ }
+
+ private float getCurrentTarget(boolean inFront) {
+ return inFront ? mInFrontTarget : mBehindTarget;
+ }
+
+ private void setCurrentTarget(boolean inFront, float target) {
+ if (inFront) {
+ mInFrontTarget = target;
+ } else {
+ mBehindTarget = target;
+ }
+ }
+
+ private Animator getCurrentAnimator(boolean inFront) {
+ return inFront ? mInFrontAnimator : mBehindAnimator;
+ }
+
+ private void setCurrentAnimator(boolean inFront, Animator animator) {
+ if (inFront) {
+ mInFrontAnimator = animator;
+ } else {
+ mBehindAnimator = animator;
+ }
+ }
+
+ private void setDozeAlpha(boolean inFront, float alpha) {
+ if (inFront) {
+ mScrimController.setDozeInFrontAlpha(alpha);
+ } else {
+ mScrimController.setDozeBehindAlpha(alpha);
+ }
+ }
+
+ private float getDozeAlpha(boolean inFront) {
+ return inFront
+ ? mScrimController.getDozeInFrontAlpha()
+ : mScrimController.getDozeBehindAlpha();
+ }
+
+ private final Runnable mPulseIn = new Runnable() {
+ @Override
+ public void run() {
+ if (DEBUG) Log.d(TAG, "Pulse in, mDozing=" + mDozing);
+ if (!mDozing) return;
+ DozeLog.tracePulseStart();
+ startScrimAnimation(true /* inFront */, 0f, mDozeParameters.getPulseInDuration(),
+ mPulseInInterpolator, mDozeParameters.getPulseInDelay(), mPulseInFinished);
+
+ // Signal that the pulse is ready to turn the screen on and draw.
+ pulseStarted();
+ }
+ };
+
+ private final Runnable mPulseInFinished = new Runnable() {
+ @Override
+ public void run() {
+ if (DEBUG) Log.d(TAG, "Pulse in finished, mDozing=" + mDozing);
+ if (!mDozing) return;
+ mHandler.postDelayed(mPulseOut, mDozeParameters.getPulseVisibleDuration());
+ }
+ };
+
+ private final Runnable mPulseOut = new Runnable() {
+ @Override
+ public void run() {
+ if (DEBUG) Log.d(TAG, "Pulse out, mDozing=" + mDozing);
+ if (!mDozing) return;
+ startScrimAnimation(true /* inFront */, 1f, mDozeParameters.getPulseOutDuration(),
+ mPulseOutInterpolator, 0 /* delay */, mPulseOutFinished);
+ }
+ };
+
+ private final Runnable mPulseOutFinished = new Runnable() {
+ @Override
+ public void run() {
+ if (DEBUG) Log.d(TAG, "Pulse out finished");
+ DozeLog.tracePulseFinish();
+
+ // Signal that the pulse is all finished so we can turn the screen off now.
+ pulseFinished();
+ }
+ };
+}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
index 9d7d310..de99a82 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -23,10 +23,7 @@
import android.animation.ValueAnimator;
import android.content.Context;
import android.content.res.Configuration;
-import android.graphics.Color;
-import android.graphics.drawable.ColorDrawable;
import android.util.AttributeSet;
-import android.util.LayoutDirection;
import android.util.MathUtils;
import android.view.MotionEvent;
import android.view.VelocityTracker;
@@ -63,8 +60,6 @@
private static final float HEADER_RUBBERBAND_FACTOR = 2.05f;
private static final float LOCK_ICON_ACTIVE_SCALE = 1.2f;
- private static final int DOZE_BACKGROUND_COLOR = 0xff000000;
- private static final int TAG_KEY_ANIM = R.id.scrim;
public static final long DOZE_ANIMATION_DURATION = 700;
private KeyguardAffordanceHelper mAfforanceHelper;
@@ -1824,11 +1819,9 @@
if (dozing == mDozing) return;
mDozing = dozing;
if (mDozing) {
- setBackgroundColorAlpha(DOZE_BACKGROUND_COLOR, 0xff, false /*animate*/);
mKeyguardStatusBar.setVisibility(View.INVISIBLE);
mKeyguardBottomArea.setVisibility(View.INVISIBLE);
} else {
- setBackgroundColorAlpha(DOZE_BACKGROUND_COLOR, 0, animate);
mKeyguardBottomArea.setVisibility(View.VISIBLE);
mKeyguardStatusBar.setVisibility(View.VISIBLE);
if (animate) {
@@ -1843,52 +1836,6 @@
return mDozing;
}
- private void setBackgroundColorAlpha(int rgb, int targetAlpha,
- boolean animate) {
- int currentAlpha = getBackgroundAlpha(this);
- if (currentAlpha == targetAlpha) {
- return;
- }
- final int r = Color.red(rgb);
- final int g = Color.green(rgb);
- final int b = Color.blue(rgb);
- Object runningAnim = getTag(TAG_KEY_ANIM);
- if (runningAnim instanceof ValueAnimator) {
- ((ValueAnimator) runningAnim).cancel();
- }
- if (!animate) {
- setBackgroundColor(Color.argb(targetAlpha, r, g, b));
- return;
- }
- ValueAnimator anim = ValueAnimator.ofInt(currentAlpha, targetAlpha);
- anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
- @Override
- public void onAnimationUpdate(ValueAnimator animation) {
- int value = (int) animation.getAnimatedValue();
- setBackgroundColor(Color.argb(value, r, g, b));
- }
- });
- anim.setInterpolator(mDozeAnimationInterpolator);
- anim.setDuration(DOZE_ANIMATION_DURATION);
- anim.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- setTag(TAG_KEY_ANIM, null);
- }
- });
- anim.start();
- setTag(TAG_KEY_ANIM, anim);
- }
-
- private static int getBackgroundAlpha(View view) {
- if (view.getBackground() instanceof ColorDrawable) {
- ColorDrawable drawable = (ColorDrawable) view.getBackground();
- return Color.alpha(drawable.getColor());
- } else {
- return 0;
- }
- }
-
public void setShadeEmpty(boolean shadeEmpty) {
mShadeEmpty = shadeEmpty;
updateEmptyShadeView();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index 988534b..d94f122 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -414,6 +414,7 @@
private ViewMediatorCallback mKeyguardViewMediatorCallback;
private ScrimController mScrimController;
+ private DozeScrimController mDozeScrimController;
private final Runnable mAutohide = new Runnable() {
@Override
@@ -741,6 +742,7 @@
mScrimController = new ScrimController(scrimBehind, scrimInFront, mScrimSrcModeEnabled);
mScrimController.setBackDropView(mBackdrop);
mStatusBarView.setScrimController(mScrimController);
+ mDozeScrimController = new DozeScrimController(mScrimController, context);
mHeader = (StatusBarHeaderView) mStatusBarWindow.findViewById(R.id.header);
mHeader.setActivityStarter(this);
@@ -3677,13 +3679,14 @@
if (mState != StatusBarState.KEYGUARD && !mNotificationPanel.isDozing()) {
return;
}
- mNotificationPanel.setDozing(mDozing, mScrimController.isPulsing() /*animate*/);
+ mNotificationPanel.setDozing(mDozing, mDozeScrimController.isPulsing() /*animate*/);
if (mDozing) {
mStackScroller.setDark(true, false /*animate*/);
} else {
mStackScroller.setDark(false, false /*animate*/);
}
- mScrimController.setDozing(mDozing, mScrimController.isPulsing() /*animate*/);
+ mScrimController.setDozing(mDozing);
+ mDozeScrimController.setDozing(mDozing, mDozeScrimController.isPulsing() /* animate */);
}
public void updateStackScrollerState(boolean goingToFullShade) {
@@ -4060,11 +4063,12 @@
}
public void wakeUpIfDozing(long time, boolean fromTouch) {
- if (mDozing && mScrimController.isPulsing()) {
+ if (mDozing && mDozeScrimController.isPulsing()) {
PowerManager pm = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
pm.wakeUp(time);
if (fromTouch) {
mScreenOnComingFromTouch = true;
+ mNotificationPanel.setTouchDisabled(false);
}
}
}
@@ -4174,7 +4178,7 @@
}
private void handlePulseWhileDozing(@NonNull PulseCallback callback) {
- mScrimController.pulse(callback);
+ mDozeScrimController.pulse(callback);
}
private void handleStopDozing() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
index 10d6594..d6bd94b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
@@ -19,20 +19,15 @@
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
-import android.annotation.NonNull;
import android.content.Context;
import android.graphics.Color;
-import android.util.Log;
import android.view.View;
import android.view.ViewTreeObserver;
import android.view.animation.AnimationUtils;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.Interpolator;
-import android.view.animation.PathInterpolator;
import com.android.systemui.R;
-import com.android.systemui.doze.DozeHost;
-import com.android.systemui.doze.DozeLog;
import com.android.systemui.statusbar.BackDropView;
import com.android.systemui.statusbar.ScrimView;
@@ -41,9 +36,6 @@
* security method gets shown).
*/
public class ScrimController implements ViewTreeObserver.OnPreDrawListener {
- private static final String TAG = "ScrimController";
- private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
-
public static final long ANIMATION_DURATION = 220;
private static final float SCRIM_BEHIND_ALPHA = 0.62f;
@@ -55,7 +47,6 @@
private final ScrimView mScrimBehind;
private final ScrimView mScrimInFront;
private final UnlockMethodCache mUnlockMethodCache;
- private final DozeParameters mDozeParameters;
private boolean mKeyguardShowing;
private float mFraction;
@@ -70,15 +61,15 @@
private long mAnimationDelay;
private Runnable mOnAnimationFinished;
private boolean mAnimationStarted;
- private boolean mDozing;
- private boolean mPulsingOut;
- private DozeHost.PulseCallback mPulseCallback;
private final Interpolator mInterpolator = new DecelerateInterpolator();
private final Interpolator mLinearOutSlowInInterpolator;
- private final Interpolator mPulseInInterpolator = PhoneStatusBar.ALPHA_OUT;
- private final Interpolator mPulseOutInterpolator = PhoneStatusBar.ALPHA_IN;
private BackDropView mBackDropView;
private boolean mScrimSrcEnabled;
+ private boolean mDozing;
+ private float mDozeInFrontAlpha;
+ private float mDozeBehindAlpha;
+ private float mCurrentInFrontAlpha;
+ private float mCurrentBehindAlpha;
public ScrimController(ScrimView scrimBehind, ScrimView scrimInFront, boolean scrimSrcEnabled) {
mScrimBehind = scrimBehind;
@@ -87,7 +78,6 @@
mUnlockMethodCache = UnlockMethodCache.getInstance(context);
mLinearOutSlowInInterpolator = AnimationUtils.loadInterpolator(context,
android.R.interpolator.linear_out_slow_in);
- mDozeParameters = new DozeParameters(context);
mScrimSrcEnabled = scrimSrcEnabled;
}
@@ -134,60 +124,27 @@
scheduleUpdate();
}
- public void setDozing(boolean dozing, boolean animate) {
- if (mDozing == dozing) return;
+ public void setDozing(boolean dozing) {
mDozing = dozing;
- if (!mDozing) {
- cancelPulsing();
- mAnimateChange = animate;
- }
scheduleUpdate();
}
- /** When dozing, fade screen contents in and out using the front scrim. */
- public void pulse(@NonNull DozeHost.PulseCallback callback) {
- if (callback == null) {
- throw new IllegalArgumentException("callback must not be null");
- }
-
- if (!mDozing || mPulseCallback != null) {
- // Pulse suppressed.
- callback.onPulseFinished();
- return;
- }
-
- // Begin pulse. Note that it's very important that the pulse finished callback
- // be invoked when we're done so that the caller can drop the pulse wakelock.
- mPulseCallback = callback;
- mScrimInFront.post(mPulseIn);
+ public void setDozeInFrontAlpha(float alpha) {
+ mDozeInFrontAlpha = alpha;
+ updateScrimColor(mScrimInFront);
}
- public boolean isPulsing() {
- return mPulseCallback != null;
+ public void setDozeBehindAlpha(float alpha) {
+ mDozeBehindAlpha = alpha;
+ updateScrimColor(mScrimBehind);
}
- private void cancelPulsing() {
- if (DEBUG) Log.d(TAG, "Cancel pulsing");
-
- if (mPulseCallback != null) {
- mScrimInFront.removeCallbacks(mPulseIn);
- mScrimInFront.removeCallbacks(mPulseOut);
- pulseFinished();
- }
+ public float getDozeBehindAlpha() {
+ return mDozeBehindAlpha;
}
- private void pulseStarted() {
- if (mPulseCallback != null) {
- mPulseCallback.onPulseStarted();
- }
- }
-
- private void pulseFinished() {
- mPulsingOut = false;
- if (mPulseCallback != null) {
- mPulseCallback.onPulseFinished();
- mPulseCallback = null;
- }
+ public float getDozeInFrontAlpha() {
+ return mDozeInFrontAlpha;
}
private void scheduleUpdate() {
@@ -223,12 +180,6 @@
} else if (mBouncerShowing) {
setScrimInFrontColor(SCRIM_IN_FRONT_ALPHA);
setScrimBehindColor(0f);
- } else if (mDozing && isPulsing() && !mPulsingOut) {
- setScrimInFrontColor(0);
- setScrimBehindColor(SCRIM_BEHIND_ALPHA_KEYGUARD);
- } else if (mDozing) {
- setScrimInFrontColor(1);
- setScrimBehindColor(SCRIM_BEHIND_ALPHA_KEYGUARD);
} else {
float fraction = Math.max(0, Math.min(mFraction, 1));
setScrimInFrontColor(0f);
@@ -272,26 +223,46 @@
((ValueAnimator) runningAnim).cancel();
scrim.setTag(TAG_KEY_ANIM, null);
}
- int color = Color.argb((int) (alpha * 255), 0, 0, 0);
if (mAnimateChange) {
- startScrimAnimation(scrim, color);
+ startScrimAnimation(scrim, alpha);
} else {
- scrim.setScrimColor(color);
+ setCurrentScrimAlpha(scrim, alpha);
+ updateScrimColor(scrim);
}
}
- private void startScrimAnimation(final ScrimView scrim, int targetColor) {
- int current = Color.alpha(scrim.getScrimColor());
- int target = Color.alpha(targetColor);
- if (current == target) {
- return;
+ private float getDozeAlpha(View scrim) {
+ return scrim == mScrimBehind ? mDozeBehindAlpha : mDozeInFrontAlpha;
+ }
+
+ private float getCurrentScrimAlpha(View scrim) {
+ return scrim == mScrimBehind ? mCurrentBehindAlpha : mCurrentInFrontAlpha;
+ }
+
+ private void setCurrentScrimAlpha(View scrim, float alpha) {
+ if (scrim == mScrimBehind) {
+ mCurrentBehindAlpha = alpha;
+ } else {
+ mCurrentInFrontAlpha = alpha;
}
- ValueAnimator anim = ValueAnimator.ofInt(current, target);
+ }
+
+ private void updateScrimColor(ScrimView scrim) {
+ float alpha1 = getCurrentScrimAlpha(scrim);
+ float alpha2 = getDozeAlpha(scrim);
+ float alpha = 1 - (1 - alpha1) * (1 - alpha2);
+ scrim.setScrimColor(Color.argb((int) (alpha * 255), 0, 0, 0));
+ }
+
+ private void startScrimAnimation(final ScrimView scrim, float target) {
+ float current = getCurrentScrimAlpha(scrim);
+ ValueAnimator anim = ValueAnimator.ofFloat(current, target);
anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
- int value = (int) animation.getAnimatedValue();
- scrim.setScrimColor(Color.argb(value, 0, 0, 0));
+ float alpha = (float) animation.getAnimatedValue();
+ setCurrentScrimAlpha(scrim, alpha);
+ updateScrimColor(scrim);
}
});
anim.setInterpolator(getInterpolator());
@@ -313,15 +284,7 @@
}
private Interpolator getInterpolator() {
- if (mAnimateKeyguardFadingOut) {
- return mLinearOutSlowInInterpolator;
- } else if (isPulsing() && !mPulsingOut) {
- return mPulseInInterpolator;
- } else if (isPulsing()) {
- return mPulseOutInterpolator;
- } else {
- return mInterpolator;
- }
+ return mAnimateKeyguardFadingOut ? mLinearOutSlowInInterpolator : mInterpolator;
}
@Override
@@ -342,56 +305,6 @@
return true;
}
- private final Runnable mPulseIn = new Runnable() {
- @Override
- public void run() {
- if (DEBUG) Log.d(TAG, "Pulse in, mDozing=" + mDozing);
- if (!mDozing) return;
- DozeLog.tracePulseStart();
- mDurationOverride = mDozeParameters.getPulseInDuration();
- mAnimationDelay = mDozeParameters.getPulseInDelay();
- mAnimateChange = true;
- mOnAnimationFinished = mPulseInFinished;
- scheduleUpdate();
-
- // Signal that the pulse is ready to turn the screen on and draw.
- pulseStarted();
- }
- };
-
- private final Runnable mPulseInFinished = new Runnable() {
- @Override
- public void run() {
- if (DEBUG) Log.d(TAG, "Pulse in finished, mDozing=" + mDozing);
- if (!mDozing) return;
- mScrimInFront.postDelayed(mPulseOut, mDozeParameters.getPulseVisibleDuration());
- }
- };
-
- private final Runnable mPulseOut = new Runnable() {
- @Override
- public void run() {
- if (DEBUG) Log.d(TAG, "Pulse out, mDozing=" + mDozing);
- if (!mDozing) return;
- mDurationOverride = mDozeParameters.getPulseOutDuration();
- mAnimateChange = true;
- mOnAnimationFinished = mPulseOutFinished;
- mPulsingOut = true;
- scheduleUpdate();
- }
- };
-
- private final Runnable mPulseOutFinished = new Runnable() {
- @Override
- public void run() {
- if (DEBUG) Log.d(TAG, "Pulse out finished");
- DozeLog.tracePulseFinish();
-
- // Signal that the pulse is all finished so we can turn the screen off now.
- pulseFinished();
- }
- };
-
public void setBackDropView(BackDropView backDropView) {
mBackDropView = backDropView;
mBackDropView.setOnVisibilityChangedRunnable(new Runnable() {
diff --git a/services/core/java/com/android/server/accounts/AccountManagerService.java b/services/core/java/com/android/server/accounts/AccountManagerService.java
index d480f68..85eed859 100644
--- a/services/core/java/com/android/server/accounts/AccountManagerService.java
+++ b/services/core/java/com/android/server/accounts/AccountManagerService.java
@@ -77,7 +77,6 @@
import com.android.internal.util.ArrayUtils;
import com.android.internal.util.IndentingPrintWriter;
import com.android.server.FgThread;
-
import com.google.android.collect.Lists;
import com.google.android.collect.Sets;
@@ -1043,7 +1042,8 @@
}
@Override
- public void removeAccount(IAccountManagerResponse response, Account account) {
+ public void removeAccount(IAccountManagerResponse response, Account account,
+ boolean expectActivityLaunch) {
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Log.v(TAG, "removeAccount: " + account
+ ", response " + response
@@ -1088,7 +1088,7 @@
}
try {
- new RemoveAccountSession(accounts, response, account).bind();
+ new RemoveAccountSession(accounts, response, account, expectActivityLaunch).bind();
} finally {
restoreCallingIdentity(identityToken);
}
@@ -1096,7 +1096,7 @@
@Override
public void removeAccountAsUser(IAccountManagerResponse response, Account account,
- int userId) {
+ boolean expectActivityLaunch, int userId) {
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Log.v(TAG, "removeAccount: " + account
+ ", response " + response
@@ -1145,7 +1145,30 @@
}
try {
- new RemoveAccountSession(accounts, response, account).bind();
+ new RemoveAccountSession(accounts, response, account, expectActivityLaunch).bind();
+ } finally {
+ restoreCallingIdentity(identityToken);
+ }
+ }
+
+ @Override
+ public boolean removeAccountExplicitly(Account account) {
+ if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ Log.v(TAG, "removeAccountExplicitly: " + account
+ + ", caller's uid " + Binder.getCallingUid()
+ + ", pid " + Binder.getCallingPid());
+ }
+ if (account == null) throw new IllegalArgumentException("account is null");
+ checkAuthenticateAccountsPermission(account);
+
+ UserAccounts accounts = getUserAccountsForCaller();
+ int userId = Binder.getCallingUserHandle().getIdentifier();
+ if (!canUserModifyAccounts(userId) || !canUserModifyAccountsForType(userId, account.type)) {
+ return false;
+ }
+ long identityToken = clearCallingIdentity();
+ try {
+ return removeAccountInternal(accounts, account);
} finally {
restoreCallingIdentity(identityToken);
}
@@ -1154,8 +1177,8 @@
private class RemoveAccountSession extends Session {
final Account mAccount;
public RemoveAccountSession(UserAccounts accounts, IAccountManagerResponse response,
- Account account) {
- super(accounts, response, account.type, false /* expectActivityLaunch */,
+ Account account, boolean expectActivityLaunch) {
+ super(accounts, response, account.type, expectActivityLaunch,
true /* stripAuthTokenFromResult */);
mAccount = account;
}
@@ -1203,10 +1226,12 @@
removeAccountInternal(getUserAccountsForCaller(), account);
}
- private void removeAccountInternal(UserAccounts accounts, Account account) {
+ private boolean removeAccountInternal(UserAccounts accounts, Account account) {
+ int deleted;
synchronized (accounts.cacheLock) {
final SQLiteDatabase db = accounts.openHelper.getWritableDatabase();
- db.delete(TABLE_ACCOUNTS, ACCOUNTS_NAME + "=? AND " + ACCOUNTS_TYPE+ "=?",
+ deleted = db.delete(TABLE_ACCOUNTS, ACCOUNTS_NAME + "=? AND " + ACCOUNTS_TYPE
+ + "=?",
new String[]{account.name, account.type});
removeAccountFromCacheLocked(accounts, account);
sendAccountsChangedBroadcast(accounts.userId);
@@ -1226,6 +1251,7 @@
Binder.restoreCallingIdentity(id);
}
}
+ return (deleted > 0);
}
@Override
diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
index 120002e..38809cb 100644
--- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java
+++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
@@ -121,7 +121,7 @@
static final boolean DEBUG_RELEASE = DEBUG || false;
static final boolean DEBUG_SAVED_STATE = DEBUG || false;
static final boolean DEBUG_SCREENSHOTS = DEBUG || false;
- static final boolean DEBUG_STATES = DEBUG || true;
+ static final boolean DEBUG_STATES = DEBUG || false;
static final boolean DEBUG_VISIBLE_BEHIND = DEBUG || false;
public static final int HOME_STACK_ID = 0;
diff --git a/services/core/java/com/android/server/media/MediaSessionService.java b/services/core/java/com/android/server/media/MediaSessionService.java
index 02c9fcb5..ba18f48 100644
--- a/services/core/java/com/android/server/media/MediaSessionService.java
+++ b/services/core/java/com/android/server/media/MediaSessionService.java
@@ -805,7 +805,12 @@
+ flags + ", suggestedStream=" + suggestedStream);
}
- if (session == null) {
+ boolean preferSuggestedStream = false;
+ if (isValidLocalStreamType(suggestedStream)
+ && AudioSystem.isStreamActive(suggestedStream, 0)) {
+ preferSuggestedStream = true;
+ }
+ if (session == null || preferSuggestedStream) {
if ((flags & AudioManager.FLAG_ACTIVE_MEDIA_ONLY) != 0
&& !AudioSystem.isStreamActive(AudioManager.STREAM_MUSIC, 0)) {
if (DEBUG) {
@@ -959,6 +964,12 @@
return keyCode == KeyEvent.KEYCODE_HEADSETHOOK;
}
+ // we only handle public stream types, which are 0-5
+ private boolean isValidLocalStreamType(int streamType) {
+ return streamType >= AudioManager.STREAM_VOICE_CALL
+ && streamType <= AudioManager.STREAM_NOTIFICATION;
+ }
+
private KeyEventWakeLockReceiver mKeyEventReceiver = new KeyEventWakeLockReceiver(mHandler);
class KeyEventWakeLockReceiver extends ResultReceiver implements Runnable,
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index 9a2451e..b1ff398 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -8982,6 +8982,7 @@
&& isVerificationEnabled(userIdentifier, installFlags)) {
final Intent verification = new Intent(
Intent.ACTION_PACKAGE_NEEDS_VERIFICATION);
+ verification.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
verification.setDataAndType(Uri.fromFile(new File(origin.resolvedPath)),
PACKAGE_MIME_TYPE);
verification.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index eb418ed6..bcfd7f0 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -2541,7 +2541,7 @@
}
mInputMonitor.updateInputWindowsLw(false /*force*/);
- if (true || localLOGV || DEBUG_ADD_REMOVE) Slog.v(TAG, "addWindow: New client "
+ if (localLOGV || DEBUG_ADD_REMOVE) Slog.v(TAG, "addWindow: New client "
+ client.asBinder() + ": window=" + win + " Callers=" + Debug.getCallers(5));
if (win.isVisibleOrAdding() && updateOrientationFromAppTokensLocked(false)) {
@@ -2706,8 +2706,7 @@
mPolicy.removeWindowLw(win);
win.removeLocked();
- if (true || DEBUG_ADD_REMOVE) Slog.v(TAG, "removeWindowInnerLocked: " + win +
- " Callers=" + Debug.getCallers(5));
+ if (DEBUG_ADD_REMOVE) Slog.v(TAG, "removeWindowInnerLocked: " + win);
mWindowMap.remove(win.mClient.asBinder());
if (win.mAppOp != AppOpsManager.OP_NONE) {
mAppOps.finishOp(win.mAppOp, win.getOwningUid(), win.getOwningPackage());