diff options
26 files changed, 575 insertions, 347 deletions
diff --git a/api/17.txt b/api/17.txt index d002449864a3..e0011591f4c4 100644 --- a/api/17.txt +++ b/api/17.txt @@ -26107,35 +26107,6 @@ package android.view.textservice { package android.webkit { - public final deprecated class CacheManager { - ctor public CacheManager(); - method public static deprecated boolean cacheDisabled(); - method public static deprecated boolean endCacheTransaction(); - method public static deprecated android.webkit.CacheManager.CacheResult getCacheFile(java.lang.String, java.util.Map<java.lang.String, java.lang.String>); - method public static deprecated java.io.File getCacheFileBaseDir(); - method public static deprecated void saveCacheFile(java.lang.String, android.webkit.CacheManager.CacheResult); - method public static deprecated boolean startCacheTransaction(); - } - - public static deprecated class CacheManager.CacheResult { - ctor public CacheManager.CacheResult(); - method public java.lang.String getContentDisposition(); - method public long getContentLength(); - method public java.lang.String getETag(); - method public java.lang.String getEncoding(); - method public long getExpires(); - method public java.lang.String getExpiresString(); - method public int getHttpStatusCode(); - method public java.io.InputStream getInputStream(); - method public java.lang.String getLastModified(); - method public java.lang.String getLocalPath(); - method public java.lang.String getLocation(); - method public java.lang.String getMimeType(); - method public java.io.OutputStream getOutputStream(); - method public void setEncoding(java.lang.String); - method public void setInputStream(java.io.InputStream); - } - public class ConsoleMessage { ctor public ConsoleMessage(java.lang.String, java.lang.String, int, android.webkit.ConsoleMessage.MessageLevel); method public int lineNumber(); @@ -26298,7 +26269,6 @@ package android.webkit { public class WebHistoryItem implements java.lang.Cloneable { method public android.graphics.Bitmap getFavicon(); - method public deprecated int getId(); method public java.lang.String getOriginalUrl(); method public java.lang.String getTitle(); method public java.lang.String getUrl(); @@ -26357,7 +26327,6 @@ package android.webkit { method public synchronized boolean getLoadsImagesAutomatically(); method public synchronized int getMinimumFontSize(); method public synchronized int getMinimumLogicalFontSize(); - method public deprecated boolean getNavDump(); method public synchronized android.webkit.WebSettings.PluginState getPluginState(); method public deprecated synchronized boolean getPluginsEnabled(); method public deprecated synchronized java.lang.String getPluginsPath(); @@ -26368,10 +26337,7 @@ package android.webkit { method public synchronized java.lang.String getStandardFontFamily(); method public deprecated synchronized android.webkit.WebSettings.TextSize getTextSize(); method public synchronized int getTextZoom(); - method public deprecated synchronized boolean getUseDoubleTree(); - method public deprecated boolean getUseWebViewBackgroundForOverscrollBackground(); method public synchronized boolean getUseWideViewPort(); - method public deprecated synchronized int getUserAgent(); method public synchronized java.lang.String getUserAgentString(); method public void setAllowContentAccess(boolean); method public void setAllowFileAccess(boolean); @@ -26406,7 +26372,6 @@ package android.webkit { method public synchronized void setLoadsImagesAutomatically(boolean); method public synchronized void setMinimumFontSize(int); method public synchronized void setMinimumLogicalFontSize(int); - method public deprecated void setNavDump(boolean); method public void setNeedInitialFocus(boolean); method public synchronized void setPluginState(android.webkit.WebSettings.PluginState); method public deprecated synchronized void setPluginsEnabled(boolean); @@ -26421,10 +26386,7 @@ package android.webkit { method public void setSupportZoom(boolean); method public deprecated synchronized void setTextSize(android.webkit.WebSettings.TextSize); method public synchronized void setTextZoom(int); - method public deprecated synchronized void setUseDoubleTree(boolean); - method public deprecated void setUseWebViewBackgroundForOverscrollBackground(boolean); method public synchronized void setUseWideViewPort(boolean); - method public deprecated synchronized void setUserAgent(int); method public synchronized void setUserAgentString(java.lang.String); method public synchronized boolean supportMultipleWindows(); method public boolean supportZoom(); @@ -26529,12 +26491,8 @@ package android.webkit { method public void clearSslPreferences(); method public void clearView(); method public android.webkit.WebBackForwardList copyBackForwardList(); - method public deprecated void debugDump(); method public void destroy(); - method public static deprecated void disablePlatformNotifications(); method public void documentHasImages(android.os.Message); - method public deprecated void emulateShiftHeld(); - method public static deprecated void enablePlatformNotifications(); method public static java.lang.String findAddress(java.lang.String); method public deprecated int findAll(java.lang.String); method public void findAllAsync(java.lang.String); @@ -26552,7 +26510,6 @@ package android.webkit { method public android.webkit.WebSettings getSettings(); method public java.lang.String getTitle(); method public java.lang.String getUrl(); - method public deprecated int getVisibleTitleHeight(); method public void goBack(); method public void goBackOrForward(int); method public void goForward(); @@ -26577,11 +26534,9 @@ package android.webkit { method public void removeJavascriptInterface(java.lang.String); method public void requestFocusNodeHref(android.os.Message); method public void requestImageRef(android.os.Message); - method public deprecated boolean restorePicture(android.os.Bundle, java.io.File); method public android.webkit.WebBackForwardList restoreState(android.os.Bundle); method public void resumeTimers(); method public void savePassword(java.lang.String, java.lang.String, java.lang.String); - method public deprecated boolean savePicture(android.os.Bundle, java.io.File); method public android.webkit.WebBackForwardList saveState(android.os.Bundle); method public void saveWebArchive(java.lang.String); method public void saveWebArchive(java.lang.String, boolean, android.webkit.ValueCallback<java.lang.String>); @@ -26593,7 +26548,6 @@ package android.webkit { method public void setInitialScale(int); method public void setMapTrackballToArrowKeys(boolean); method public void setNetworkAvailable(boolean); - method public deprecated void setPictureListener(android.webkit.WebView.PictureListener); method public void setVerticalScrollbarOverlay(boolean); method public void setWebChromeClient(android.webkit.WebChromeClient); method public void setWebViewClient(android.webkit.WebViewClient); @@ -26677,7 +26631,6 @@ package android.webkit { method public boolean hasFormData(); method public boolean hasHttpAuthUsernamePassword(); method public boolean hasUsernamePassword(); - field protected static final java.lang.String LOGTAG = "webviewdatabase"; } public class WebViewFragment extends android.app.Fragment { diff --git a/api/current.txt b/api/current.txt index cda6be188adc..7bb8d1be36ed 100644 --- a/api/current.txt +++ b/api/current.txt @@ -20188,10 +20188,6 @@ package android.sax { package android.security { - public class AndroidKeyPairGeneratorSpec implements java.security.spec.AlgorithmParameterSpec { - ctor public AndroidKeyPairGeneratorSpec(android.content.Context, java.lang.String, javax.security.auth.x500.X500Principal, java.math.BigInteger, java.util.Date, java.util.Date); - } - public final class KeyChain { ctor public KeyChain(); method public static void choosePrivateKeyAlias(android.app.Activity, android.security.KeyChainAliasCallback, java.lang.String[], java.security.Principal[], java.lang.String, int, java.lang.String); @@ -22205,9 +22201,9 @@ package android.text.format { method public static java.lang.String formatElapsedTime(long); method public static java.lang.String formatElapsedTime(java.lang.StringBuilder, long); method public static final java.lang.CharSequence formatSameDayTime(long, long, int, int); - method public static java.lang.String getAMPMString(int); - method public static java.lang.String getDayOfWeekString(int, int); - method public static java.lang.String getMonthString(int, int); + method public static deprecated java.lang.String getAMPMString(int); + method public static deprecated java.lang.String getDayOfWeekString(int, int); + method public static deprecated java.lang.String getMonthString(int, int); method public static java.lang.CharSequence getRelativeDateTimeString(android.content.Context, long, long, long, int); method public static java.lang.CharSequence getRelativeTimeSpanString(long); method public static java.lang.CharSequence getRelativeTimeSpanString(long, long, long); @@ -22215,24 +22211,24 @@ package android.text.format { method public static java.lang.CharSequence getRelativeTimeSpanString(android.content.Context, long, boolean); method public static java.lang.CharSequence getRelativeTimeSpanString(android.content.Context, long); method public static boolean isToday(long); - field public static final java.lang.String ABBREV_MONTH_FORMAT = "%b"; + field public static final deprecated java.lang.String ABBREV_MONTH_FORMAT = "%b"; field public static final java.lang.String ABBREV_WEEKDAY_FORMAT = "%a"; field public static final long DAY_IN_MILLIS = 86400000L; // 0x5265c00L - field public static final int FORMAT_12HOUR = 64; // 0x40 - field public static final int FORMAT_24HOUR = 128; // 0x80 + field public static final deprecated int FORMAT_12HOUR = 64; // 0x40 + field public static final deprecated int FORMAT_24HOUR = 128; // 0x80 field public static final int FORMAT_ABBREV_ALL = 524288; // 0x80000 field public static final int FORMAT_ABBREV_MONTH = 65536; // 0x10000 field public static final int FORMAT_ABBREV_RELATIVE = 262144; // 0x40000 field public static final int FORMAT_ABBREV_TIME = 16384; // 0x4000 field public static final int FORMAT_ABBREV_WEEKDAY = 32768; // 0x8000 - field public static final int FORMAT_CAP_AMPM = 256; // 0x100 - field public static final int FORMAT_CAP_MIDNIGHT = 4096; // 0x1000 - field public static final int FORMAT_CAP_NOON = 1024; // 0x400 - field public static final int FORMAT_CAP_NOON_MIDNIGHT = 5120; // 0x1400 + field public static final deprecated int FORMAT_CAP_AMPM = 256; // 0x100 + field public static final deprecated int FORMAT_CAP_MIDNIGHT = 4096; // 0x1000 + field public static final deprecated int FORMAT_CAP_NOON = 1024; // 0x400 + field public static final deprecated int FORMAT_CAP_NOON_MIDNIGHT = 5120; // 0x1400 field public static final int FORMAT_NO_MIDNIGHT = 2048; // 0x800 field public static final int FORMAT_NO_MONTH_DAY = 32; // 0x20 field public static final int FORMAT_NO_NOON = 512; // 0x200 - field public static final int FORMAT_NO_NOON_MIDNIGHT = 2560; // 0xa00 + field public static final deprecated int FORMAT_NO_NOON_MIDNIGHT = 2560; // 0xa00 field public static final int FORMAT_NO_YEAR = 8; // 0x8 field public static final int FORMAT_NUMERIC_DATE = 131072; // 0x20000 field public static final int FORMAT_SHOW_DATE = 16; // 0x10 @@ -22241,12 +22237,12 @@ package android.text.format { field public static final int FORMAT_SHOW_YEAR = 4; // 0x4 field public static final deprecated int FORMAT_UTC = 8192; // 0x2000 field public static final long HOUR_IN_MILLIS = 3600000L; // 0x36ee80L - field public static final java.lang.String HOUR_MINUTE_24 = "%H:%M"; - field public static final int LENGTH_LONG = 10; // 0xa - field public static final int LENGTH_MEDIUM = 20; // 0x14 - field public static final int LENGTH_SHORT = 30; // 0x1e - field public static final int LENGTH_SHORTER = 40; // 0x28 - field public static final int LENGTH_SHORTEST = 50; // 0x32 + field public static final deprecated java.lang.String HOUR_MINUTE_24 = "%H:%M"; + field public static final deprecated int LENGTH_LONG = 10; // 0xa + field public static final deprecated int LENGTH_MEDIUM = 20; // 0x14 + field public static final deprecated int LENGTH_SHORT = 30; // 0x1e + field public static final deprecated int LENGTH_SHORTER = 40; // 0x28 + field public static final deprecated int LENGTH_SHORTEST = 50; // 0x32 field public static final long MINUTE_IN_MILLIS = 60000L; // 0xea60L field public static final java.lang.String MONTH_DAY_FORMAT = "%-d"; field public static final java.lang.String MONTH_FORMAT = "%B"; @@ -22257,8 +22253,8 @@ package android.text.format { field public static final java.lang.String YEAR_FORMAT = "%Y"; field public static final java.lang.String YEAR_FORMAT_TWO_DIGITS = "%g"; field public static final long YEAR_IN_MILLIS = 31449600000L; // 0x7528ad000L - field public static final int[] sameMonthTable; - field public static final int[] sameYearTable; + field public static final deprecated int[] sameMonthTable; + field public static final deprecated int[] sameYearTable; } public final class Formatter { @@ -26054,9 +26050,13 @@ package android.view.accessibility { field public static final deprecated int MAX_TEXT_LENGTH = 500; // 0x1f4 field public static final int TYPES_ALL_MASK = -1; // 0xffffffff field public static final int TYPE_ANNOUNCEMENT = 16384; // 0x4000 + field public static final int TYPE_GESTURE_DETECTION_END = 524288; // 0x80000 + field public static final int TYPE_GESTURE_DETECTION_START = 262144; // 0x40000 field public static final int TYPE_NOTIFICATION_STATE_CHANGED = 64; // 0x40 field public static final int TYPE_TOUCH_EXPLORATION_GESTURE_END = 1024; // 0x400 field public static final int TYPE_TOUCH_EXPLORATION_GESTURE_START = 512; // 0x200 + field public static final int TYPE_TOUCH_INTERACTION_END = 2097152; // 0x200000 + field public static final int TYPE_TOUCH_INTERACTION_START = 1048576; // 0x100000 field public static final int TYPE_VIEW_ACCESSIBILITY_FOCUSED = 32768; // 0x8000 field public static final int TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED = 65536; // 0x10000 field public static final int TYPE_VIEW_CLICKED = 1; // 0x1 @@ -26922,35 +26922,6 @@ package android.view.textservice { package android.webkit { - public final deprecated class CacheManager { - ctor public CacheManager(); - method public static deprecated boolean cacheDisabled(); - method public static deprecated boolean endCacheTransaction(); - method public static deprecated android.webkit.CacheManager.CacheResult getCacheFile(java.lang.String, java.util.Map<java.lang.String, java.lang.String>); - method public static deprecated java.io.File getCacheFileBaseDir(); - method public static deprecated void saveCacheFile(java.lang.String, android.webkit.CacheManager.CacheResult); - method public static deprecated boolean startCacheTransaction(); - } - - public static deprecated class CacheManager.CacheResult { - ctor public CacheManager.CacheResult(); - method public java.lang.String getContentDisposition(); - method public long getContentLength(); - method public java.lang.String getETag(); - method public java.lang.String getEncoding(); - method public long getExpires(); - method public java.lang.String getExpiresString(); - method public int getHttpStatusCode(); - method public java.io.InputStream getInputStream(); - method public java.lang.String getLastModified(); - method public java.lang.String getLocalPath(); - method public java.lang.String getLocation(); - method public java.lang.String getMimeType(); - method public java.io.OutputStream getOutputStream(); - method public void setEncoding(java.lang.String); - method public void setInputStream(java.io.InputStream); - } - public class ConsoleMessage { ctor public ConsoleMessage(java.lang.String, java.lang.String, int, android.webkit.ConsoleMessage.MessageLevel); method public int lineNumber(); @@ -27116,7 +27087,6 @@ package android.webkit { public class WebHistoryItem implements java.lang.Cloneable { method public android.graphics.Bitmap getFavicon(); - method public deprecated int getId(); method public java.lang.String getOriginalUrl(); method public java.lang.String getTitle(); method public java.lang.String getUrl(); @@ -27177,7 +27147,6 @@ package android.webkit { method public boolean getMediaPlaybackRequiresUserGesture(); method public synchronized int getMinimumFontSize(); method public synchronized int getMinimumLogicalFontSize(); - method public deprecated boolean getNavDump(); method public synchronized android.webkit.WebSettings.PluginState getPluginState(); method public deprecated synchronized boolean getPluginsEnabled(); method public deprecated synchronized java.lang.String getPluginsPath(); @@ -27188,10 +27157,7 @@ package android.webkit { method public synchronized java.lang.String getStandardFontFamily(); method public deprecated synchronized android.webkit.WebSettings.TextSize getTextSize(); method public synchronized int getTextZoom(); - method public deprecated synchronized boolean getUseDoubleTree(); - method public deprecated boolean getUseWebViewBackgroundForOverscrollBackground(); method public synchronized boolean getUseWideViewPort(); - method public deprecated synchronized int getUserAgent(); method public synchronized java.lang.String getUserAgentString(); method public void setAllowContentAccess(boolean); method public void setAllowFileAccess(boolean); @@ -27227,7 +27193,6 @@ package android.webkit { method public void setMediaPlaybackRequiresUserGesture(boolean); method public synchronized void setMinimumFontSize(int); method public synchronized void setMinimumLogicalFontSize(int); - method public deprecated void setNavDump(boolean); method public void setNeedInitialFocus(boolean); method public synchronized void setPluginState(android.webkit.WebSettings.PluginState); method public deprecated synchronized void setPluginsEnabled(boolean); @@ -27242,10 +27207,8 @@ package android.webkit { method public void setSupportZoom(boolean); method public deprecated synchronized void setTextSize(android.webkit.WebSettings.TextSize); method public synchronized void setTextZoom(int); - method public deprecated synchronized void setUseDoubleTree(boolean); method public deprecated void setUseWebViewBackgroundForOverscrollBackground(boolean); method public synchronized void setUseWideViewPort(boolean); - method public deprecated synchronized void setUserAgent(int); method public synchronized void setUserAgentString(java.lang.String); method public synchronized boolean supportMultipleWindows(); method public boolean supportZoom(); @@ -27350,12 +27313,8 @@ package android.webkit { method public void clearSslPreferences(); method public void clearView(); method public android.webkit.WebBackForwardList copyBackForwardList(); - method public deprecated void debugDump(); method public void destroy(); - method public static deprecated void disablePlatformNotifications(); method public void documentHasImages(android.os.Message); - method public deprecated void emulateShiftHeld(); - method public static deprecated void enablePlatformNotifications(); method public static java.lang.String findAddress(java.lang.String); method public deprecated int findAll(java.lang.String); method public void findAllAsync(java.lang.String); @@ -27373,7 +27332,6 @@ package android.webkit { method public android.webkit.WebSettings getSettings(); method public java.lang.String getTitle(); method public java.lang.String getUrl(); - method public deprecated int getVisibleTitleHeight(); method public void goBack(); method public void goBackOrForward(int); method public void goForward(); @@ -27398,11 +27356,9 @@ package android.webkit { method public void removeJavascriptInterface(java.lang.String); method public void requestFocusNodeHref(android.os.Message); method public void requestImageRef(android.os.Message); - method public deprecated boolean restorePicture(android.os.Bundle, java.io.File); method public android.webkit.WebBackForwardList restoreState(android.os.Bundle); method public void resumeTimers(); method public void savePassword(java.lang.String, java.lang.String, java.lang.String); - method public deprecated boolean savePicture(android.os.Bundle, java.io.File); method public android.webkit.WebBackForwardList saveState(android.os.Bundle); method public void saveWebArchive(java.lang.String); method public void saveWebArchive(java.lang.String, boolean, android.webkit.ValueCallback<java.lang.String>); @@ -27414,7 +27370,6 @@ package android.webkit { method public void setInitialScale(int); method public deprecated void setMapTrackballToArrowKeys(boolean); method public void setNetworkAvailable(boolean); - method public deprecated void setPictureListener(android.webkit.WebView.PictureListener); method public void setVerticalScrollbarOverlay(boolean); method public void setWebChromeClient(android.webkit.WebChromeClient); method public void setWebViewClient(android.webkit.WebViewClient); @@ -27498,7 +27453,6 @@ package android.webkit { method public boolean hasFormData(); method public boolean hasHttpAuthUsernamePassword(); method public boolean hasUsernamePassword(); - field protected static final java.lang.String LOGTAG = "webviewdatabase"; } public class WebViewFragment extends android.app.Fragment { diff --git a/core/java/android/accounts/ChooseTypeAndAccountActivity.java b/core/java/android/accounts/ChooseTypeAndAccountActivity.java index 6b3b7fd59f52..5358bc796ab9 100644 --- a/core/java/android/accounts/ChooseTypeAndAccountActivity.java +++ b/core/java/android/accounts/ChooseTypeAndAccountActivity.java @@ -15,6 +15,8 @@ */ package android.accounts; +import com.google.android.collect.Sets; + import android.app.Activity; import android.content.Intent; import android.os.Bundle; @@ -105,6 +107,13 @@ public class ChooseTypeAndAccountActivity extends Activity private static final int SELECTED_ITEM_NONE = -1; + private Set<Account> mSetOfAllowableAccounts; + private Set<String> mSetOfRelevantAccountTypes; + private String mSelectedAccountName = null; + private boolean mSelectedAddNewAccount = false; + private boolean mAlwaysPromptForAccount = false; + private String mDescriptionOverride; + private ArrayList<Account> mAccounts; private int mPendingRequest = REQUEST_NULL; private Parcelable[] mExistingAccounts = null; @@ -120,22 +129,18 @@ public class ChooseTypeAndAccountActivity extends Activity } // save some items we use frequently - final AccountManager accountManager = AccountManager.get(this); final Intent intent = getIntent(); - String selectedAccountName = null; - boolean selectedAddNewAccount = false; - if (savedInstanceState != null) { mPendingRequest = savedInstanceState.getInt(KEY_INSTANCE_STATE_PENDING_REQUEST); mExistingAccounts = savedInstanceState.getParcelableArray(KEY_INSTANCE_STATE_EXISTING_ACCOUNTS); // Makes sure that any user selection is preserved across orientation changes. - selectedAccountName = savedInstanceState.getString( + mSelectedAccountName = savedInstanceState.getString( KEY_INSTANCE_STATE_SELECTED_ACCOUNT_NAME); - selectedAddNewAccount = savedInstanceState.getBoolean( + mSelectedAddNewAccount = savedInstanceState.getBoolean( KEY_INSTANCE_STATE_SELECTED_ADD_ACCOUNT, false); } else { mPendingRequest = REQUEST_NULL; @@ -144,85 +149,38 @@ public class ChooseTypeAndAccountActivity extends Activity // show is as pre-selected. Account selectedAccount = (Account) intent.getParcelableExtra(EXTRA_SELECTED_ACCOUNT); if (selectedAccount != null) { - selectedAccountName = selectedAccount.name; + mSelectedAccountName = selectedAccount.name; } } if (Log.isLoggable(TAG, Log.VERBOSE)) { - Log.v(TAG, "selected account name is " + selectedAccountName); + Log.v(TAG, "selected account name is " + mSelectedAccountName); } - // build an efficiently queryable map of account types to authenticator descriptions - final HashMap<String, AuthenticatorDescription> typeToAuthDescription = - new HashMap<String, AuthenticatorDescription>(); - for(AuthenticatorDescription desc : accountManager.getAuthenticatorTypes()) { - typeToAuthDescription.put(desc.type, desc); - } - - // Read the validAccounts, if present, and add them to the setOfAllowableAccounts - Set<Account> setOfAllowableAccounts = null; - final ArrayList<Parcelable> validAccounts = - intent.getParcelableArrayListExtra(EXTRA_ALLOWABLE_ACCOUNTS_ARRAYLIST); - if (validAccounts != null) { - setOfAllowableAccounts = new HashSet<Account>(validAccounts.size()); - for (Parcelable parcelable : validAccounts) { - setOfAllowableAccounts.add((Account)parcelable); - } - } - // An account type is relevant iff it is allowed by the caller and supported by the account - // manager. - Set<String> setOfRelevantAccountTypes = null; - final String[] allowedAccountTypes = - intent.getStringArrayExtra(EXTRA_ALLOWABLE_ACCOUNT_TYPES_STRING_ARRAY); - if (allowedAccountTypes != null) { - - setOfRelevantAccountTypes = new HashSet<String>(allowedAccountTypes.length); - Set<String> setOfAllowedAccountTypes = new HashSet<String>(allowedAccountTypes.length); - for (String type : allowedAccountTypes) { - setOfAllowedAccountTypes.add(type); - } - - AuthenticatorDescription[] descs = AccountManager.get(this).getAuthenticatorTypes(); - Set<String> supportedAccountTypes = new HashSet<String>(descs.length); - for (AuthenticatorDescription desc : descs) { - supportedAccountTypes.add(desc.type); - } + mSetOfAllowableAccounts = getAllowableAccountSet(intent); + mSetOfRelevantAccountTypes = getReleventAccountTypes(intent); + mAlwaysPromptForAccount = intent.getBooleanExtra(EXTRA_ALWAYS_PROMPT_FOR_ACCOUNT, false); + mDescriptionOverride = intent.getStringExtra(EXTRA_DESCRIPTION_TEXT_OVERRIDE); + } - for (String acctType : setOfAllowedAccountTypes) { - if (supportedAccountTypes.contains(acctType)) { - setOfRelevantAccountTypes.add(acctType); - } - } - } + @Override + protected void onResume() { + super.onResume(); + final AccountManager accountManager = AccountManager.get(this); - // Create a list of AccountInfo objects for each account that is allowable. Filter out - // accounts that don't match the allowable types, if provided, or that don't match the - // allowable accounts, if provided. - final Account[] accounts = accountManager.getAccounts(); - mAccounts = new ArrayList<Account>(accounts.length); - mSelectedItemIndex = SELECTED_ITEM_NONE; - for (Account account : accounts) { - if (setOfAllowableAccounts != null - && !setOfAllowableAccounts.contains(account)) { - continue; - } - if (setOfRelevantAccountTypes != null - && !setOfRelevantAccountTypes.contains(account.type)) { - continue; - } - if (account.name.equals(selectedAccountName)) { - mSelectedItemIndex = mAccounts.size(); - } - mAccounts.add(account); - } + mAccounts = getAcceptableAccountChoices(accountManager); + // In cases where the activity does not need to show an account picker, cut the chase + // and return the result directly. Eg: + // Single account -> select it directly + // No account -> launch add account activity directly if (mPendingRequest == REQUEST_NULL) { // If there are no relevant accounts and only one relevant account type go directly to // add account. Otherwise let the user choose. if (mAccounts.isEmpty()) { - if (setOfRelevantAccountTypes.size() == 1) { - runAddAccountForAuthenticator(setOfRelevantAccountTypes.iterator().next()); + if (mSetOfRelevantAccountTypes.size() == 1) { + runAddAccountForAuthenticator(mSetOfRelevantAccountTypes.iterator().next()); } else { startChooseAccountTypeActivity(); } @@ -230,61 +188,22 @@ public class ChooseTypeAndAccountActivity extends Activity } // if there is only one allowable account return it - if (!intent.getBooleanExtra(EXTRA_ALWAYS_PROMPT_FOR_ACCOUNT, false) - && mAccounts.size() == 1) { + if (!mAlwaysPromptForAccount && mAccounts.size() == 1) { Account account = mAccounts.get(0); setResultAndFinish(account.name, account.type); return; } } + String[] listItems = getListOfDisplayableOptions(mAccounts); + mSelectedItemIndex = getItemIndexToSelect( + mAccounts, mSelectedAccountName, mSelectedAddNewAccount); + // Cannot set content view until we know that mPendingRequest is not null, otherwise // would cause screen flicker. setContentView(R.layout.choose_type_and_account); - - // Override the description text if supplied - final String descriptionOverride = - intent.getStringExtra(EXTRA_DESCRIPTION_TEXT_OVERRIDE); - TextView descriptionView = (TextView) findViewById(R.id.description); - if (!TextUtils.isEmpty(descriptionOverride)) { - descriptionView.setText(descriptionOverride); - } else { - descriptionView.setVisibility(View.GONE); - } - - // List of options includes all accounts found together with "Add new account" as the - // last item in the list. - String[] listItems = new String[mAccounts.size() + 1]; - for (int i = 0; i < mAccounts.size(); i++) { - listItems[i] = mAccounts.get(i).name; - } - listItems[mAccounts.size()] = getResources().getString( - R.string.add_account_button_label); - - ListView list = (ListView) findViewById(android.R.id.list); - list.setAdapter(new ArrayAdapter<String>(this, - android.R.layout.simple_list_item_single_choice, listItems)); - list.setChoiceMode(ListView.CHOICE_MODE_SINGLE); - list.setItemsCanFocus(false); - list.setOnItemClickListener(new AdapterView.OnItemClickListener() { - @Override - public void onItemClick(AdapterView<?> parent, View v, int position, long id) { - mSelectedItemIndex = position; - mOkButton.setEnabled(true); - } - }); - - // If "Add account" option was previously selected by user, preserve it across - // orientation changes. - if (selectedAddNewAccount) { - mSelectedItemIndex = mAccounts.size(); - } - if (mSelectedItemIndex != SELECTED_ITEM_NONE) { - list.setItemChecked(mSelectedItemIndex, true); - if (Log.isLoggable(TAG, Log.VERBOSE)) { - Log.v(TAG, "List item " + mSelectedItemIndex + " should be selected"); - } - } + overrideDescriptionIfSupplied(mDescriptionOverride); + populateUIAccountList(listItems); // Only enable "OK" button if something has been selected. mOkButton = (Button) findViewById(android.R.id.button2); @@ -480,4 +399,137 @@ public class ChooseTypeAndAccountActivity extends Activity startActivityForResult(intent, REQUEST_CHOOSE_TYPE); mPendingRequest = REQUEST_CHOOSE_TYPE; } + + /** + * @return a value between 0 (inclusive) and accounts.size() (inclusive) or SELECTED_ITEM_NONE. + * An index value of accounts.size() indicates 'Add account' option. + */ + private int getItemIndexToSelect(ArrayList<Account> accounts, String selectedAccountName, + boolean selectedAddNewAccount) { + // If "Add account" option was previously selected by user, preserve it across + // orientation changes. + if (selectedAddNewAccount) { + return accounts.size(); + } + // search for the selected account name if present + for (int i = 0; i < accounts.size(); i++) { + if (accounts.get(i).name.equals(selectedAccountName)) { + return i; + } + } + // no account selected. + return SELECTED_ITEM_NONE; + } + + private String[] getListOfDisplayableOptions(ArrayList<Account> accounts) { + // List of options includes all accounts found together with "Add new account" as the + // last item in the list. + String[] listItems = new String[accounts.size() + 1]; + for (int i = 0; i < accounts.size(); i++) { + listItems[i] = accounts.get(i).name; + } + listItems[accounts.size()] = getResources().getString( + R.string.add_account_button_label); + return listItems; + } + + /** + * Create a list of Account objects for each account that is acceptable. Filter out + * accounts that don't match the allowable types, if provided, or that don't match the + * allowable accounts, if provided. + */ + private ArrayList<Account> getAcceptableAccountChoices(AccountManager accountManager) { + final Account[] accounts = accountManager.getAccounts(); + ArrayList<Account> accountsToPopulate = new ArrayList<Account>(accounts.length); + for (Account account : accounts) { + if (mSetOfAllowableAccounts != null + && !mSetOfAllowableAccounts.contains(account)) { + continue; + } + if (mSetOfRelevantAccountTypes != null + && !mSetOfRelevantAccountTypes.contains(account.type)) { + continue; + } + accountsToPopulate.add(account); + } + return accountsToPopulate; + } + + /** + * Return a set of account types speficied by the intent as well as supported by the + * AccountManager. + */ + private Set<String> getReleventAccountTypes(final Intent intent) { + // An account type is relevant iff it is allowed by the caller and supported by the account + // manager. + Set<String> setOfRelevantAccountTypes = null; + final String[] allowedAccountTypes = + intent.getStringArrayExtra(EXTRA_ALLOWABLE_ACCOUNT_TYPES_STRING_ARRAY); + if (allowedAccountTypes != null) { + setOfRelevantAccountTypes = Sets.newHashSet(allowedAccountTypes); + AuthenticatorDescription[] descs = AccountManager.get(this).getAuthenticatorTypes(); + Set<String> supportedAccountTypes = new HashSet<String>(descs.length); + for (AuthenticatorDescription desc : descs) { + supportedAccountTypes.add(desc.type); + } + setOfRelevantAccountTypes.retainAll(supportedAccountTypes); + } + return setOfRelevantAccountTypes; + } + + /** + * Returns a set of whitelisted accounts given by the intent or null if none specified by the + * intent. + */ + private Set<Account> getAllowableAccountSet(final Intent intent) { + Set<Account> setOfAllowableAccounts = null; + final ArrayList<Parcelable> validAccounts = + intent.getParcelableArrayListExtra(EXTRA_ALLOWABLE_ACCOUNTS_ARRAYLIST); + if (validAccounts != null) { + setOfAllowableAccounts = new HashSet<Account>(validAccounts.size()); + for (Parcelable parcelable : validAccounts) { + setOfAllowableAccounts.add((Account)parcelable); + } + } + return setOfAllowableAccounts; + } + + /** + * Overrides the description text view for the picker activity if specified by the intent. + * If not specified then makes the description invisible. + */ + private void overrideDescriptionIfSupplied(String descriptionOverride) { + TextView descriptionView = (TextView) findViewById(R.id.description); + if (!TextUtils.isEmpty(descriptionOverride)) { + descriptionView.setText(descriptionOverride); + } else { + descriptionView.setVisibility(View.GONE); + } + } + + /** + * Populates the UI ListView with the given list of items and selects an item + * based on {@code mSelectedItemIndex} member variable. + */ + private final void populateUIAccountList(String[] listItems) { + ListView list = (ListView) findViewById(android.R.id.list); + list.setAdapter(new ArrayAdapter<String>(this, + android.R.layout.simple_list_item_single_choice, listItems)); + list.setChoiceMode(ListView.CHOICE_MODE_SINGLE); + list.setItemsCanFocus(false); + list.setOnItemClickListener( + new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView<?> parent, View v, int position, long id) { + mSelectedItemIndex = position; + mOkButton.setEnabled(true); + } + }); + if (mSelectedItemIndex != SELECTED_ITEM_NONE) { + list.setItemChecked(mSelectedItemIndex, true); + if (Log.isLoggable(TAG, Log.VERBOSE)) { + Log.v(TAG, "List item " + mSelectedItemIndex + " should be selected"); + } + } + } } diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index 1cd5fa29b1b8..cb4d4a116956 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -84,7 +84,6 @@ import android.view.Window; import android.view.WindowManager; import android.view.WindowManagerGlobal; import android.renderscript.RenderScript; -import android.security.AndroidKeyStoreProvider; import com.android.internal.os.BinderInternal; import com.android.internal.os.RuntimeInit; @@ -4891,8 +4890,6 @@ public final class ActivityThread { // Set the reporter for event logging in libcore EventLogger.setReporter(new EventLoggingReporter()); - Security.addProvider(new AndroidKeyStoreProvider()); - Process.setArgV0("<pre-initialized>"); Looper.prepareMainLooper(); diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java index 53995835b5e8..4784d7f5144b 100644 --- a/core/java/android/content/pm/PackageManager.java +++ b/core/java/android/content/pm/PackageManager.java @@ -1151,6 +1151,22 @@ public abstract class PackageManager { = "android.content.pm.extra.VERIFICATION_INSTALL_FLAGS"; /** + * Extra field name for the uid of who is requesting to install + * the package. + * + * @hide + */ + public static final String EXTRA_VERIFICATION_INSTALLER_UID + = "android.content.pm.extra.VERIFICATION_INSTALLER_UID"; + + /** + * Extra field name for the package name of a package pending verification. + * + * @hide + */ + public static final String EXTRA_VERIFICATION_PACKAGE_NAME + = "android.content.pm.extra.VERIFICATION_PACKAGE_NAME"; + /** * Extra field name for the result of a verification, either * {@link #VERIFICATION_ALLOW}, or {@link #VERIFICATION_REJECT}. * Passed to package verifiers after a package is verified. @@ -1159,6 +1175,14 @@ public abstract class PackageManager { = "android.content.pm.extra.VERIFICATION_RESULT"; /** + * Extra field name for the version code of a package pending verification. + * + * @hide + */ + public static final String EXTRA_VERIFICATION_VERSION_CODE + = "android.content.pm.extra.VERIFICATION_VERSION_CODE"; + + /** * Retrieve overall information about an application package that is * installed on the system. * <p> diff --git a/core/java/android/content/pm/VerificationParams.java b/core/java/android/content/pm/VerificationParams.java index 9bec87e4f020..6454de005555 100644 --- a/core/java/android/content/pm/VerificationParams.java +++ b/core/java/android/content/pm/VerificationParams.java @@ -39,6 +39,9 @@ public class VerificationParams implements Parcelable { /** HTTP referrer URI associated with the originatingURI. */ private final Uri mReferrer; + /** UID of application requesting the install */ + private int mInstallerUid; + /** * An object that holds the digest of the package which can be used to * verify ownership. @@ -63,6 +66,7 @@ public class VerificationParams implements Parcelable { mOriginatingURI = originatingURI; mReferrer = referrer; mManifestDigest = manifestDigest; + mInstallerUid = -1; } public Uri getVerificationURI() { @@ -81,6 +85,15 @@ public class VerificationParams implements Parcelable { return mManifestDigest; } + /** @return -1 when not set */ + public int getInstallerUid() { + return mInstallerUid; + } + + public void setInstallerUid(int uid) { + mInstallerUid = uid; + } + @Override public int describeContents() { return 0; @@ -126,6 +139,10 @@ public class VerificationParams implements Parcelable { return false; } + if (mInstallerUid != other.mInstallerUid) { + return false; + } + return true; } @@ -137,6 +154,7 @@ public class VerificationParams implements Parcelable { hash += 7 * (mOriginatingURI==null?1:mOriginatingURI.hashCode()); hash += 11 * (mReferrer==null?1:mReferrer.hashCode()); hash += 13 * (mManifestDigest==null?1:mManifestDigest.hashCode()); + hash += 17 * mInstallerUid; return hash; } @@ -153,6 +171,8 @@ public class VerificationParams implements Parcelable { sb.append(mReferrer.toString()); sb.append(",mManifestDigest="); sb.append(mManifestDigest.toString()); + sb.append(",mInstallerUid="); + sb.append(mInstallerUid); sb.append('}'); return sb.toString(); @@ -164,6 +184,7 @@ public class VerificationParams implements Parcelable { dest.writeParcelable(mOriginatingURI, 0); dest.writeParcelable(mReferrer, 0); dest.writeParcelable(mManifestDigest, 0); + dest.writeInt(mInstallerUid); } @@ -172,6 +193,7 @@ public class VerificationParams implements Parcelable { mOriginatingURI = source.readParcelable(Uri.class.getClassLoader()); mReferrer = source.readParcelable(Uri.class.getClassLoader()); mManifestDigest = source.readParcelable(ManifestDigest.class.getClassLoader()); + mInstallerUid = source.readInt(); } public static final Parcelable.Creator<VerificationParams> CREATOR = diff --git a/core/java/android/net/http/CertificateChainValidator.java b/core/java/android/net/http/CertificateChainValidator.java index 6ad8fe38c11f..f66075d66b75 100644 --- a/core/java/android/net/http/CertificateChainValidator.java +++ b/core/java/android/net/http/CertificateChainValidator.java @@ -168,7 +168,13 @@ public class CertificateChainValidator { } try { - SSLParametersImpl.getDefaultTrustManager().checkServerTrusted(chain, authType); + X509TrustManager x509TrustManager = SSLParametersImpl.getDefaultTrustManager(); + if (x509TrustManager instanceof TrustManagerImpl) { + TrustManagerImpl trustManager = (TrustManagerImpl) x509TrustManager; + trustManager.checkServerTrusted(chain, authType, domain); + } else { + x509TrustManager.checkServerTrusted(chain, authType); + } return null; // No errors. } catch (GeneralSecurityException e) { if (HttpLog.LOGV) { diff --git a/core/java/android/text/format/DateUtils.java b/core/java/android/text/format/DateUtils.java index 211453d58f30..2e962a004348 100644 --- a/core/java/android/text/format/DateUtils.java +++ b/core/java/android/text/format/DateUtils.java @@ -161,12 +161,17 @@ public class DateUtils public static final int FORMAT_NO_YEAR = 0x00008; public static final int FORMAT_SHOW_DATE = 0x00010; public static final int FORMAT_NO_MONTH_DAY = 0x00020; + @Deprecated public static final int FORMAT_12HOUR = 0x00040; + @Deprecated public static final int FORMAT_24HOUR = 0x00080; + @Deprecated public static final int FORMAT_CAP_AMPM = 0x00100; public static final int FORMAT_NO_NOON = 0x00200; + @Deprecated public static final int FORMAT_CAP_NOON = 0x00400; public static final int FORMAT_NO_MIDNIGHT = 0x00800; + @Deprecated public static final int FORMAT_CAP_MIDNIGHT = 0x01000; /** * @deprecated Use @@ -181,19 +186,25 @@ public class DateUtils public static final int FORMAT_NUMERIC_DATE = 0x20000; public static final int FORMAT_ABBREV_RELATIVE = 0x40000; public static final int FORMAT_ABBREV_ALL = 0x80000; + @Deprecated public static final int FORMAT_CAP_NOON_MIDNIGHT = (FORMAT_CAP_NOON | FORMAT_CAP_MIDNIGHT); + @Deprecated public static final int FORMAT_NO_NOON_MIDNIGHT = (FORMAT_NO_NOON | FORMAT_NO_MIDNIGHT); // Date and time format strings that are constant and don't need to be // translated. /** * This is not actually the preferred 24-hour date format in all locales. + * @deprecated use {@link java.text.SimpleDateFormat} instead. */ + @Deprecated public static final String HOUR_MINUTE_24 = "%H:%M"; public static final String MONTH_FORMAT = "%B"; /** * This is not actually a useful month name in all locales. + * @deprecated use {@link java.text.SimpleDateFormat} instead. */ + @Deprecated public static final String ABBREV_MONTH_FORMAT = "%b"; public static final String NUMERIC_MONTH_FORMAT = "%m"; public static final String MONTH_DAY_FORMAT = "%-d"; @@ -207,6 +218,7 @@ public class DateUtils // The index is constructed from a bit-wise OR of the boolean values: // {showTime, showYear, showWeekDay}. For example, if showYear and // showWeekDay are both true, then the index would be 3. + /** @deprecated do not use. */ public static final int sameYearTable[] = { com.android.internal.R.string.same_year_md1_md2, com.android.internal.R.string.same_year_wday1_md1_wday2_md2, @@ -233,6 +245,7 @@ public class DateUtils // The index is constructed from a bit-wise OR of the boolean values: // {showTime, showYear, showWeekDay}. For example, if showYear and // showWeekDay are both true, then the index would be 3. + /** @deprecated do not use. */ public static final int sameMonthTable[] = { com.android.internal.R.string.same_month_md1_md2, com.android.internal.R.string.same_month_wday1_md1_wday2_md2, @@ -259,7 +272,9 @@ public class DateUtils * * @more <p> * e.g. "Sunday" or "January" + * @deprecated use {@link java.text.SimpleDateFormat} instead. */ + @Deprecated public static final int LENGTH_LONG = 10; /** @@ -268,7 +283,9 @@ public class DateUtils * * @more <p> * e.g. "Sun" or "Jan" + * @deprecated use {@link java.text.SimpleDateFormat} instead. */ + @Deprecated public static final int LENGTH_MEDIUM = 20; /** @@ -278,14 +295,18 @@ public class DateUtils * <p>e.g. "Su" or "Jan" * <p>In most languages, the results returned for LENGTH_SHORT will be the same as * the results returned for {@link #LENGTH_MEDIUM}. + * @deprecated use {@link java.text.SimpleDateFormat} instead. */ + @Deprecated public static final int LENGTH_SHORT = 30; /** * Request an even shorter abbreviated version of the name. * Do not use this. Currently this will always return the same result * as {@link #LENGTH_SHORT}. + * @deprecated use {@link java.text.SimpleDateFormat} instead. */ + @Deprecated public static final int LENGTH_SHORTER = 40; /** @@ -295,7 +316,9 @@ public class DateUtils * <p>e.g. "S", "T", "T" or "J" * <p>In some languages, the results returned for LENGTH_SHORTEST will be the same as * the results returned for {@link #LENGTH_SHORT}. + * @deprecated use {@link java.text.SimpleDateFormat} instead. */ + @Deprecated public static final int LENGTH_SHORTEST = 50; /** @@ -309,7 +332,9 @@ public class DateUtils * Undefined lengths will return {@link #LENGTH_MEDIUM} * but may return something different in the future. * @throws IndexOutOfBoundsException if the dayOfWeek is out of bounds. + * @deprecated use {@link java.text.SimpleDateFormat} instead. */ + @Deprecated public static String getDayOfWeekString(int dayOfWeek, int abbrev) { int[] list; switch (abbrev) { @@ -330,7 +355,9 @@ public class DateUtils * @param ampm Either {@link Calendar#AM Calendar.AM} or {@link Calendar#PM Calendar.PM}. * @throws IndexOutOfBoundsException if the ampm is out of bounds. * @return Localized version of "AM" or "PM". + * @deprecated use {@link java.text.SimpleDateFormat} instead. */ + @Deprecated public static String getAMPMString(int ampm) { Resources r = Resources.getSystem(); return r.getString(sAmPm[ampm - Calendar.AM]); @@ -345,7 +372,9 @@ public class DateUtils * Undefined lengths will return {@link #LENGTH_MEDIUM} * but may return something different in the future. * @return Localized month of the year. + * @deprecated use {@link java.text.SimpleDateFormat} instead. */ + @Deprecated public static String getMonthString(int month, int abbrev) { // Note that here we use sMonthsMedium for MEDIUM, SHORT and SHORTER. // This is a shortcut to not spam the translators with too many variations @@ -378,7 +407,9 @@ public class DateUtils * but may return something different in the future. * @return Localized month of the year. * @hide Pending API council approval + * @deprecated use {@link java.text.SimpleDateFormat} instead. */ + @Deprecated public static String getStandaloneMonthString(int month, int abbrev) { // Note that here we use sMonthsMedium for MEDIUM, SHORT and SHORTER. // This is a shortcut to not spam the translators with too many variations diff --git a/core/java/android/view/accessibility/AccessibilityEvent.java b/core/java/android/view/accessibility/AccessibilityEvent.java index 1a2a194f8211..15009053571f 100644 --- a/core/java/android/view/accessibility/AccessibilityEvent.java +++ b/core/java/android/view/accessibility/AccessibilityEvent.java @@ -424,6 +424,28 @@ import java.util.List; * </ul> * </p> * <p> + * <b>Touch interaction start</b> - represents the event of starting a touch + * interaction, which is the user starts touching the screen.</br> + * <em>Type:</em> {@link #TYPE_TOUCH_INTERACTION_START}</br> + * <em>Properties:</em></br> + * <ul> + * <li>{@link #getEventType()} - The type of the event.</li> + * </ul> + * <em>Note:</em> This event is fired only by the system and is not passed to the + * view tree to be populated.</br> + * </p> + * <p> + * <b>Touch interaction end</b> - represents the event of ending a touch + * interaction, which is the user stops touching the screen.</br> + * <em>Type:</em> {@link #TYPE_TOUCH_INTERACTION_END}</br> + * <em>Properties:</em></br> + * <ul> + * <li>{@link #getEventType()} - The type of the event.</li> + * </ul> + * <em>Note:</em> This event is fired only by the system and is not passed to the + * view tree to be populated.</br> + * </p> + * <p> * <b>Touch exploration gesture start</b> - represents the event of starting a touch * exploring gesture.</br> * <em>Type:</em> {@link #TYPE_TOUCH_EXPLORATION_GESTURE_START}</br> @@ -431,15 +453,8 @@ import java.util.List; * <ul> * <li>{@link #getEventType()} - The type of the event.</li> * </ul> - * <em>Note:</em> This event type is not dispatched to descendants though - * {@link android.view.View#dispatchPopulateAccessibilityEvent(AccessibilityEvent) - * View.dispatchPopulateAccessibilityEvent(AccessibilityEvent)}, hence the event - * source {@link android.view.View} and the sub-tree rooted at it will not receive - * calls to {@link android.view.View#onPopulateAccessibilityEvent(AccessibilityEvent) - * View.onPopulateAccessibilityEvent(AccessibilityEvent)}. The preferred way to add - * text content to such events is by setting the - * {@link android.R.styleable#View_contentDescription contentDescription} of the source - * view.</br> + * <em>Note:</em> This event is fired only by the system and is not passed to the + * view tree to be populated.</br> * </p> * <p> * <b>Touch exploration gesture end</b> - represents the event of ending a touch @@ -449,15 +464,30 @@ import java.util.List; * <ul> * <li>{@link #getEventType()} - The type of the event.</li> * </ul> - * <em>Note:</em> This event type is not dispatched to descendants though - * {@link android.view.View#dispatchPopulateAccessibilityEvent(AccessibilityEvent) - * View.dispatchPopulateAccessibilityEvent(AccessibilityEvent)}, hence the event - * source {@link android.view.View} and the sub-tree rooted at it will not receive - * calls to {@link android.view.View#onPopulateAccessibilityEvent(AccessibilityEvent) - * View.onPopulateAccessibilityEvent(AccessibilityEvent)}. The preferred way to add - * text content to such events is by setting the - * {@link android.R.styleable#View_contentDescription contentDescription} of the source - * view.</br> + * <em>Note:</em> This event is fired only by the system and is not passed to the + * view tree to be populated.</br> + * </p> + * <p> + * <b>Touch gesture detection start</b> - represents the event of starting a user + * gesture detection.</br> + * <em>Type:</em> {@link #TYPE_GESTURE_DETECTION_START}</br> + * <em>Properties:</em></br> + * <ul> + * <li>{@link #getEventType()} - The type of the event.</li> + * </ul> + * <em>Note:</em> This event is fired only by the system and is not passed to the + * view tree to be populated.</br> + * </p> + * <p> + * <b>Touch gesture detection end</b> - represents the event of ending a user + * gesture detection.</br> + * <em>Type:</em> {@link #TYPE_GESTURE_DETECTION_END}</br> + * <em>Properties:</em></br> + * <ul> + * <li>{@link #getEventType()} - The type of the event.</li> + * </ul> + * <em>Note:</em> This event is fired only by the system and is not passed to the + * view tree to be populated.</br> * </p> * <p> * <b>MISCELLANEOUS TYPES</b></br> @@ -610,6 +640,26 @@ public final class AccessibilityEvent extends AccessibilityRecord implements Par public static final int TYPE_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY = 0x00020000; /** + * Represents the event of beginning gesture detection. + */ + public static final int TYPE_GESTURE_DETECTION_START = 0x00040000; + + /** + * Represents the event of ending gesture detection. + */ + public static final int TYPE_GESTURE_DETECTION_END = 0x00080000; + + /** + * Represents the event of the user starting to touch the screen. + */ + public static final int TYPE_TOUCH_INTERACTION_START = 0x00100000; + + /** + * Represents the event of the user ending to touch the screen. + */ + public static final int TYPE_TOUCH_INTERACTION_END = 0x00200000; + + /** * Mask for {@link AccessibilityEvent} all types. * * @see #TYPE_VIEW_CLICKED @@ -628,6 +678,10 @@ public final class AccessibilityEvent extends AccessibilityRecord implements Par * @see #TYPE_VIEW_TEXT_SELECTION_CHANGED * @see #TYPE_ANNOUNCEMENT * @see #TYPE_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY + * @see #TYPE_GESTURE_DETECTION_START + * @see #TYPE_GESTURE_DETECTION_END + * @see #TYPE_TOUCH_INTERACTION_START + * @see #TYPE_TOUCH_INTERACTION_END */ public static final int TYPES_ALL_MASK = 0xFFFFFFFF; @@ -1120,6 +1174,14 @@ public final class AccessibilityEvent extends AccessibilityRecord implements Par return "TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED"; case TYPE_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY: return "TYPE_CURRENT_AT_GRANULARITY_MOVEMENT_CHANGED"; + case TYPE_GESTURE_DETECTION_START: + return "TYPE_GESTURE_DETECTION_START"; + case TYPE_GESTURE_DETECTION_END: + return "TYPE_GESTURE_DETECTION_END"; + case TYPE_TOUCH_INTERACTION_START: + return "TYPE_TOUCH_INTERACTION_START"; + case TYPE_TOUCH_INTERACTION_END: + return "TYPE_TOUCH_INTERACTION_END"; default: return null; } diff --git a/core/java/android/webkit/CacheManager.java b/core/java/android/webkit/CacheManager.java index f0e6ff03a919..52f41e64bc96 100644 --- a/core/java/android/webkit/CacheManager.java +++ b/core/java/android/webkit/CacheManager.java @@ -32,6 +32,7 @@ import java.util.Map; /** * Manages the HTTP cache used by an application's {@link WebView} instances. * @deprecated Access to the HTTP cache will be removed in a future release. + * @hide Since {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} */ // The class CacheManager provides the persistent cache of content that is // received over the network. The component handles parsing of HTTP headers and diff --git a/core/java/android/webkit/WebHistoryItem.java b/core/java/android/webkit/WebHistoryItem.java index cc9afe057a46..9a588e411f3a 100644 --- a/core/java/android/webkit/WebHistoryItem.java +++ b/core/java/android/webkit/WebHistoryItem.java @@ -38,6 +38,7 @@ public class WebHistoryItem implements Cloneable { * same object. * @return The id for this item. * @deprecated This method is now obsolete. + * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} */ @Deprecated public int getId() { diff --git a/core/java/android/webkit/WebSettings.java b/core/java/android/webkit/WebSettings.java index a29ff3715fd0..be2d8634121d 100644 --- a/core/java/android/webkit/WebSettings.java +++ b/core/java/android/webkit/WebSettings.java @@ -164,6 +164,7 @@ public abstract class WebSettings { * is false. * * @deprecated This method is now obsolete. + * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} */ @Deprecated public void setNavDump(boolean enabled) { @@ -176,6 +177,7 @@ public abstract class WebSettings { * @return whether dumping the navigation cache is enabled * @see #setNavDump * @deprecated This method is now obsolete. + * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} */ @Deprecated public boolean getNavDump() { @@ -377,6 +379,7 @@ public abstract class WebSettings { * * @see #setUseWebViewBackgroundForOverscrollBackground * @deprecated This method is now obsolete. + * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} */ @Deprecated public boolean getUseWebViewBackgroundForOverscrollBackground() { @@ -518,6 +521,7 @@ public abstract class WebSettings { * it now has no effect. * * @deprecated This setting now has no effect. + * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} */ @Deprecated public synchronized void setUseDoubleTree(boolean use) { @@ -529,6 +533,7 @@ public abstract class WebSettings { * it now has no effect. * * @deprecated This setting now has no effect. + * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} */ @Deprecated public synchronized boolean getUseDoubleTree() { @@ -547,6 +552,7 @@ public abstract class WebSettings { * * @param ua the integer code for the user-agent string * @deprecated Please use {@link #setUserAgentString} instead. + * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} */ @Deprecated public synchronized void setUserAgent(int ua) { @@ -565,6 +571,7 @@ public abstract class WebSettings { * @return the integer code for the user-agent string * @see #setUserAgent * @deprecated Please use {@link #getUserAgentString} instead. + * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} */ @Deprecated public synchronized int getUserAgent() { @@ -1251,8 +1258,7 @@ public abstract class WebSettings { /** * Returns the default User-Agent used by a WebView. * An instance of WebView could use a different User-Agent if a call - * is made to {@link WebSettings#setUserAgent(int)} or - * {@link WebSettings#setUserAgentString(String)}. + * is made to {@link WebSettings#setUserAgentString(String)}. * * @param context a Context object used to access application assets */ diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index e1c30f7f9b41..4202a7fc1027 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -555,6 +555,7 @@ public class WebView extends AbsoluteLayout * Gets the visible height (in pixels) of the embedded title bar (if any). * * @deprecated This method is now obsolete. + * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} */ public int getVisibleTitleHeight() { checkThread(); @@ -658,6 +659,7 @@ public class WebView extends AbsoluteLayout * Notifications are enabled by default. * * @deprecated This method is now obsolete. + * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} */ @Deprecated public static void enablePlatformNotifications() { @@ -670,6 +672,7 @@ public class WebView extends AbsoluteLayout * Notifications are enabled by default. * * @deprecated This method is now obsolete. + * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} */ @Deprecated public static void disablePlatformNotifications() { @@ -694,14 +697,11 @@ public class WebView extends AbsoluteLayout * {@link android.app.Activity#onSaveInstanceState}. Please note that this * method no longer stores the display data for this WebView. The previous * behavior could potentially leak files if {@link #restoreState} was never - * called. See {@link #savePicture} and {@link #restorePicture} for saving - * and restoring the display data. + * called. * * @param outState the Bundle to store this WebView's state * @return the same copy of the back/forward list used to save the state. If * saveState fails, the returned list will be null. - * @see #savePicture - * @see #restorePicture */ public WebBackForwardList saveState(Bundle outState) { checkThread(); @@ -716,6 +716,7 @@ public class WebView extends AbsoluteLayout * overwritten with this WebView's picture data. * @return true if the picture was successfully saved * @deprecated This method is now obsolete. + * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} */ @Deprecated public boolean savePicture(Bundle b, final File dest) { @@ -732,6 +733,7 @@ public class WebView extends AbsoluteLayout * @param src the file where the picture data was stored * @return true if the picture was successfully restored * @deprecated This method is now obsolete. + * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} */ @Deprecated public boolean restorePicture(Bundle b, File src) { @@ -746,13 +748,10 @@ public class WebView extends AbsoluteLayout * it is called after this WebView has had a chance to build state (load * pages, create a back/forward list, etc.) there may be undesirable * side-effects. Please note that this method no longer restores the - * display data for this WebView. See {@link #savePicture} and {@link - * #restorePicture} for saving and restoring the display data. + * display data for this WebView. * * @param inState the incoming Bundle of state * @return the restored back/forward list or null if restoreState failed - * @see #savePicture - * @see #restorePicture */ public WebBackForwardList restoreState(Bundle inState) { checkThread(); @@ -1334,12 +1333,11 @@ public class WebView extends AbsoluteLayout } /** - * Highlights and scrolls to the next match found by {@link #findAll} or + * Highlights and scrolls to the next match found by * {@link #findAllAsync}, wrapping around page boundaries as necessary. - * Notifies any registered {@link FindListener}. If neither - * {@link #findAll} nor {@link #findAllAsync(String)} has been called yet, - * or if {@link #clearMatches} has been called since the last find - * operation, this function does nothing. + * Notifies any registered {@link FindListener}. If {@link #findAllAsync(String)} + * has not been called yet, or if {@link #clearMatches} has been called since the + * last find operation, this function does nothing. * * @param forward the direction to search * @see #setFindListener @@ -1368,8 +1366,7 @@ public class WebView extends AbsoluteLayout /** * Finds all instances of find on the page and highlights them, * asynchronously. Notifies any registered {@link FindListener}. - * Successive calls to this or {@link #findAll} will cancel any - * pending searches. + * Successive calls to this will cancel any pending searches. * * @param find the string to find. * @see #setFindListener @@ -1423,7 +1420,7 @@ public class WebView extends AbsoluteLayout /** * Clears the highlighting surrounding text matches created by - * {@link #findAll} or {@link #findAllAsync}. + * {@link #findAllAsync}. */ public void clearMatches() { checkThread(); @@ -1483,6 +1480,7 @@ public class WebView extends AbsoluteLayout * * @param listener an implementation of WebView.PictureListener * @deprecated This method is now obsolete. + * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} */ @Deprecated public void setPictureListener(PictureListener listener) { @@ -1590,6 +1588,7 @@ public class WebView extends AbsoluteLayout * functionality; it will be deprecated in the future. * * @deprecated This method is now obsolete. + * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} */ @Deprecated public void emulateShiftHeld() { @@ -1709,6 +1708,7 @@ public class WebView extends AbsoluteLayout /** * @deprecated This method is now obsolete. + * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} */ @Deprecated public void debugDump() { diff --git a/core/java/android/webkit/WebViewDatabase.java b/core/java/android/webkit/WebViewDatabase.java index 1987f53570d2..62ec0d5e4baa 100644 --- a/core/java/android/webkit/WebViewDatabase.java +++ b/core/java/android/webkit/WebViewDatabase.java @@ -29,7 +29,9 @@ import android.content.Context; * </ul> */ public class WebViewDatabase { - // TODO: deprecate/hide this. + /** + * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} + */ protected static final String LOGTAG = "webviewdatabase"; /** diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java index 6a040a6a9809..0710d96ff253 100644 --- a/core/java/com/android/internal/widget/LockPatternUtils.java +++ b/core/java/com/android/internal/widget/LockPatternUtils.java @@ -20,6 +20,7 @@ import com.android.internal.R; import com.android.internal.telephony.ITelephony; import com.google.android.collect.Lists; +import android.app.ActivityManagerNative; import android.app.admin.DevicePolicyManager; import android.content.BroadcastReceiver; import android.content.ContentResolver; @@ -225,7 +226,11 @@ public class LockPatternUtils { public int getCurrentUser() { if (Process.myUid() == Process.SYSTEM_UID) { - return mCurrentUserId; + try { + return ActivityManagerNative.getDefault().getCurrentUser().id; + } catch (RemoteException re) { + return mCurrentUserId; + } } else { throw new SecurityException("Only the system process can get the current user"); } diff --git a/core/res/res/values-fa/donottranslate-cldr.xml b/core/res/res/values-fa/donottranslate-cldr.xml index 11473fe98c7e..e605c8be6c4d 100644 --- a/core/res/res/values-fa/donottranslate-cldr.xml +++ b/core/res/res/values-fa/donottranslate-cldr.xml @@ -61,7 +61,21 @@ <string name="day_of_week_long_friday">جمعه</string> <string name="day_of_week_long_saturday">شنبه</string> + <string name="day_of_week_medium_sunday">یکشنبه</string> + <string name="day_of_week_medium_monday">دوشنبه</string> + <string name="day_of_week_medium_tuesday">سهشنبه</string> + <string name="day_of_week_medium_wednesday">چهارشنبه</string> + <string name="day_of_week_medium_thursday">پنجشنبه</string> + <string name="day_of_week_medium_friday">جمعه</string> + <string name="day_of_week_medium_saturday">شنبه</string> + <string name="day_of_week_short_sunday">۱ش</string> + <string name="day_of_week_short_monday">۲ش</string> + <string name="day_of_week_short_tuesday">۳ش</string> + <string name="day_of_week_short_wednesday">۴ش</string> + <string name="day_of_week_short_thursday">۵ش</string> + <string name="day_of_week_short_friday">ج</string> + <string name="day_of_week_short_saturday">ش</string> <string name="day_of_week_shortest_sunday">ی</string> <string name="day_of_week_shortest_monday">د</string> diff --git a/core/tests/coretests/src/android/content/pm/VerificationParamsTest.java b/core/tests/coretests/src/android/content/pm/VerificationParamsTest.java index b814e2d3b6e8..105bcba08237 100644 --- a/core/tests/coretests/src/android/content/pm/VerificationParamsTest.java +++ b/core/tests/coretests/src/android/content/pm/VerificationParamsTest.java @@ -34,6 +34,7 @@ public class VerificationParamsTest extends AndroidTestCase { private final static String ORIGINATING_URI_STRING = "http://originating.uri/path"; private final static String REFERRER_STRING = "http://referrer.uri/path"; private final static byte[] DIGEST_BYTES = "fake digest".getBytes(); + private final static int INSTALLER_UID = 42; private final static Uri VERIFICATION_URI = Uri.parse(VERIFICATION_URI_STRING); private final static Uri ORIGINATING_URI = Uri.parse(ORIGINATING_URI_STRING); @@ -115,6 +116,18 @@ public class VerificationParamsTest extends AndroidTestCase { assertFalse(params1.equals(params2)); } + public void testEquals_InstallerUid_Failure() throws Exception { + VerificationParams params1 = new VerificationParams(VERIFICATION_URI, ORIGINATING_URI, + REFERRER, MANIFEST_DIGEST); + + VerificationParams params2 = new VerificationParams( + Uri.parse(VERIFICATION_URI_STRING), Uri.parse(ORIGINATING_URI_STRING), + Uri.parse(REFERRER_STRING), new ManifestDigest(DIGEST_BYTES)); + params2.setInstallerUid(INSTALLER_UID); + + assertFalse(params1.equals(params2)); + } + public void testHashCode_Success() throws Exception { VerificationParams params1 = new VerificationParams(VERIFICATION_URI, ORIGINATING_URI, REFERRER, MANIFEST_DIGEST); @@ -168,4 +181,16 @@ public class VerificationParamsTest extends AndroidTestCase { assertFalse(params1.hashCode() == params2.hashCode()); } + + public void testHashCode_InstallerUid_Failure() throws Exception { + VerificationParams params1 = new VerificationParams(VERIFICATION_URI, ORIGINATING_URI, + REFERRER, MANIFEST_DIGEST); + + VerificationParams params2 = new VerificationParams( + Uri.parse(VERIFICATION_URI_STRING), Uri.parse(ORIGINATING_URI_STRING), + Uri.parse(REFERRER_STRING), new ManifestDigest("a different digest".getBytes())); + params2.setInstallerUid(INSTALLER_UID); + + assertFalse(params1.hashCode() == params2.hashCode()); + } } diff --git a/keystore/java/android/security/AndroidKeyPairGeneratorSpec.java b/keystore/java/android/security/AndroidKeyPairGeneratorSpec.java index 311359ca4368..79a763024c93 100644 --- a/keystore/java/android/security/AndroidKeyPairGeneratorSpec.java +++ b/keystore/java/android/security/AndroidKeyPairGeneratorSpec.java @@ -32,6 +32,7 @@ import javax.security.auth.x500.X500Principal; * generator that works with * <a href="{@docRoot}guide/topics/security/keystore.html">Android KeyStore * facility</a>. + * @hide */ public class AndroidKeyPairGeneratorSpec implements AlgorithmParameterSpec { private final String mKeystoreAlias; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsModel.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsModel.java index 031504f0ce7f..f2391102e44d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsModel.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickSettingsModel.java @@ -399,7 +399,11 @@ class QuickSettingsModel implements BluetoothStateChangeCallback, mRotationLockState.label = locked ? mContext.getString(R.string.quick_settings_rotation_locked_label) : mContext.getString(R.string.quick_settings_rotation_unlocked_label); - mRotationLockCallback.refreshView(mRotationLockTile, mRotationLockState); + + // may be called before addRotationLockTile due to RotationPolicyListener in QuickSettings + if (mRotationLockTile != null && mRotationLockCallback != null) { + mRotationLockCallback.refreshView(mRotationLockTile, mRotationLockState); + } } }
\ No newline at end of file diff --git a/policy/src/com/android/internal/policy/impl/keyguard/FaceUnlock.java b/policy/src/com/android/internal/policy/impl/keyguard/FaceUnlock.java index 5a0a2287cec3..a4159d0e69cf 100644 --- a/policy/src/com/android/internal/policy/impl/keyguard/FaceUnlock.java +++ b/policy/src/com/android/internal/policy/impl/keyguard/FaceUnlock.java @@ -153,7 +153,8 @@ public class FaceUnlock implements BiometricSensorUnlock, Handler.Callback { // This must show before bind to guarantee that Face Unlock has a place to display show(SERVICE_STARTUP_VIEW_TIMEOUT); if (!mBoundToService) { - Log.d(TAG, "Binding to Face Unlock service"); + Log.d(TAG, "Binding to Face Unlock service for user=" + + mLockPatternUtils.getCurrentUser()); mContext.bindService(new Intent(IFaceLockInterface.class.getName()), mConnection, Context.BIND_AUTO_CREATE, diff --git a/services/java/com/android/server/accessibility/AccessibilityManagerService.java b/services/java/com/android/server/accessibility/AccessibilityManagerService.java index 99ec1d2f3060..e7f3599a56ca 100644 --- a/services/java/com/android/server/accessibility/AccessibilityManagerService.java +++ b/services/java/com/android/server/accessibility/AccessibilityManagerService.java @@ -173,10 +173,6 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { private Service mQueryBridge; - private boolean mTouchExplorationGestureEnded; - - private boolean mTouchExplorationGestureStarted; - private AlertDialog mEnableTouchExplorationDialog; /** @@ -400,18 +396,6 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { } public boolean sendAccessibilityEvent(AccessibilityEvent event) { - final int eventType = event.getEventType(); - - // The event for gesture start should be strictly before the - // first hover enter event for the gesture. - if (eventType == AccessibilityEvent.TYPE_VIEW_HOVER_ENTER - && mTouchExplorationGestureStarted) { - mTouchExplorationGestureStarted = false; - AccessibilityEvent gestureStartEvent = AccessibilityEvent.obtain( - AccessibilityEvent.TYPE_TOUCH_EXPLORATION_GESTURE_START); - sendAccessibilityEvent(gestureStartEvent); - } - synchronized (mLock) { if (mSecurityPolicy.canDispatchAccessibilityEvent(event)) { mSecurityPolicy.updateActiveWindowAndEventSourceLocked(event); @@ -421,22 +405,10 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { if (mHasInputFilter && mInputFilter != null) { mMainHandler.obtainMessage(MSG_SEND_ACCESSIBILITY_EVENT_TO_INPUT_FILTER, AccessibilityEvent.obtain(event)).sendToTarget(); - } event.recycle(); mHandledFeedbackTypes = 0; } - - // The event for gesture end should be strictly after the - // last hover exit event for the gesture. - if (eventType == AccessibilityEvent.TYPE_VIEW_HOVER_EXIT - && mTouchExplorationGestureEnded) { - mTouchExplorationGestureEnded = false; - AccessibilityEvent gestureEndEvent = AccessibilityEvent.obtain( - AccessibilityEvent.TYPE_TOUCH_EXPLORATION_GESTURE_END); - sendAccessibilityEvent(gestureEndEvent); - } - return (OWN_PROCESS_ID != Binder.getCallingPid()); } @@ -628,14 +600,6 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { return mQueryBridge; } - public void touchExplorationGestureEnded() { - mTouchExplorationGestureEnded = true; - } - - public void touchExplorationGestureStarted() { - mTouchExplorationGestureStarted = true; - } - private boolean notifyGestureLocked(int gestureId, boolean isDefault) { // TODO: Now we are giving the gestures to the last enabled // service that can handle them which is the last one diff --git a/services/java/com/android/server/accessibility/TouchExplorer.java b/services/java/com/android/server/accessibility/TouchExplorer.java index 9e4f33ea81b4..cb6b31a5bedc 100644 --- a/services/java/com/android/server/accessibility/TouchExplorer.java +++ b/services/java/com/android/server/accessibility/TouchExplorer.java @@ -25,6 +25,7 @@ import android.gesture.GestureStore; import android.gesture.GestureStroke; import android.gesture.Prediction; import android.graphics.Rect; +import android.os.Build; import android.os.Handler; import android.os.SystemClock; import android.util.Slog; @@ -35,6 +36,7 @@ import android.view.VelocityTracker; import android.view.ViewConfiguration; import android.view.WindowManagerPolicy; import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityManager; import com.android.internal.R; @@ -168,6 +170,9 @@ class TouchExplorer implements EventStreamTransformation { // Temporary rectangle to avoid instantiation. private final Rect mTempRect = new Rect(); + // Context in which this explorer operates. + private final Context mContext; + // The X of the previous event. private float mPreviousX; @@ -198,6 +203,12 @@ class TouchExplorer implements EventStreamTransformation { // The id of the last touch explored window. private int mLastTouchedWindowId; + // Whether touch exploration gesture has ended. + private boolean mTouchExplorationGestureEnded; + + // Whether touch interaction has ended. + private boolean mTouchInteractionEnded; + /** * Creates a new instance. * @@ -205,11 +216,12 @@ class TouchExplorer implements EventStreamTransformation { * @param context A context handle for accessing resources. */ public TouchExplorer(Context context, AccessibilityManagerService service) { + mContext = context; mAms = service; mReceivedPointerTracker = new ReceivedPointerTracker(context); mInjectedPointerTracker = new InjectedPointerTracker(); mTapTimeout = ViewConfiguration.getTapTimeout(); - mDetermineUserIntentTimeout = (int) (mTapTimeout * 1.5f); + mDetermineUserIntentTimeout = ViewConfiguration.getDoubleTapTimeout(); mDoubleTapTimeout = ViewConfiguration.getDoubleTapTimeout(); mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop(); mDoubleTapSlop = ViewConfiguration.get(context).getScaledDoubleTapSlop(); @@ -317,9 +329,26 @@ class TouchExplorer implements EventStreamTransformation { } public void onAccessibilityEvent(AccessibilityEvent event) { + final int eventType = event.getEventType(); + + // The event for gesture end should be strictly after the + // last hover exit event. + if (mTouchExplorationGestureEnded + && eventType == AccessibilityEvent.TYPE_VIEW_HOVER_EXIT) { + mTouchExplorationGestureEnded = false; + sendAccessibilityEvent(AccessibilityEvent.TYPE_TOUCH_EXPLORATION_GESTURE_END); + } + + // The event for touch interaction end should be strictly after the + // last hover exit and the touch exploration gesture end events. + if (mTouchInteractionEnded + && eventType == AccessibilityEvent.TYPE_VIEW_HOVER_EXIT) { + mTouchInteractionEnded = false; + sendAccessibilityEvent(AccessibilityEvent.TYPE_TOUCH_INTERACTION_END); + } + // If a new window opens or the accessibility focus moves we no longer // want to click/long press on the last touch explored location. - final int eventType = event.getEventType(); switch (eventType) { case AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED: case AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED: { @@ -358,6 +387,15 @@ class TouchExplorer implements EventStreamTransformation { switch (event.getActionMasked()) { case MotionEvent.ACTION_DOWN: + // The delayed enter not delivered implies that we have delivered + // TYPE_TOUCH_INTERACTION_START and not TYPE_TOUCH_INTERACTION_END, + // therefore we need to deliver the interaction end event here. + if (mSendHoverEnterDelayed.isPending()) { + sendAccessibilityEvent(AccessibilityEvent.TYPE_TOUCH_INTERACTION_END); + } + // Announce the start of a new touch interaction. + sendAccessibilityEvent( + AccessibilityEvent.TYPE_TOUCH_INTERACTION_START); // Pre-feed the motion events to the gesture detector since we // have a distance slop before getting into gesture detection // mode and not using the points within this slop significantly @@ -396,7 +434,7 @@ class TouchExplorer implements EventStreamTransformation { // to detect what the user is trying to do. final int pointerId = receivedTracker.getPrimaryActivePointerId(); final int pointerIdBits = (1 << pointerId); - mSendHoverEnterDelayed.post(event, pointerIdBits, policyFlags); + mSendHoverEnterDelayed.post(event, true, pointerIdBits, policyFlags); } break; default: { /* do nothing - let the code for ACTION_MOVE decide what to do */ @@ -443,6 +481,10 @@ class TouchExplorer implements EventStreamTransformation { mSendHoverExitDelayed.remove(); mPerformLongPressDelayed.remove(); mExitGestureDetectionModeDelayed.post(); + // Send accessibility event to announce the start + // of gesture recognition. + sendAccessibilityEvent( + AccessibilityEvent.TYPE_GESTURE_DETECTION_START); } else { // We have just decided that the user is touch, // exploring so start sending events. @@ -551,7 +593,8 @@ class TouchExplorer implements EventStreamTransformation { // If we have not delivered the enter schedule exit. if (mSendHoverEnterDelayed.isPending()) { - mSendHoverExitDelayed.post(event, pointerIdBits, policyFlags); + mSendHoverEnterDelayed.mTouchExplorationInProgress = false; + mSendHoverExitDelayed.post(event, false, pointerIdBits, policyFlags); } else { // The user is touch exploring so we send events for end. sendExitEventsIfNeeded(policyFlags); @@ -656,6 +699,9 @@ class TouchExplorer implements EventStreamTransformation { } } break; case MotionEvent.ACTION_UP: { + // Announce the end of a new touch interaction. + sendAccessibilityEvent( + AccessibilityEvent.TYPE_TOUCH_INTERACTION_END); mCurrentState = STATE_TOUCH_EXPLORING; } break; case MotionEvent.ACTION_CANCEL: { @@ -687,6 +733,10 @@ class TouchExplorer implements EventStreamTransformation { } } break; case MotionEvent.ACTION_UP: + // Announce the end of a new touch interaction. + sendAccessibilityEvent( + AccessibilityEvent.TYPE_TOUCH_INTERACTION_END); + //$FALL-THROUGH$ case MotionEvent.ACTION_POINTER_UP: { mLongPressingPointerId = -1; mLongPressingPointerDeltaX = 0; @@ -725,6 +775,13 @@ class TouchExplorer implements EventStreamTransformation { } } break; case MotionEvent.ACTION_UP: { + // Announce the end of gesture recognition. + sendAccessibilityEvent( + AccessibilityEvent.TYPE_GESTURE_DETECTION_END); + // Announce the end of a new touch interaction. + sendAccessibilityEvent( + AccessibilityEvent.TYPE_TOUCH_INTERACTION_END); + float x = event.getX(); float y = event.getY(); mStrokeBuffer.add(new GesturePoint(x, y, event.getEventTime())); @@ -760,6 +817,19 @@ class TouchExplorer implements EventStreamTransformation { } /** + * Sends an accessibility event of the given type. + * + * @param type The event type. + */ + private void sendAccessibilityEvent(int type) { + AccessibilityManager accessibilityManager = AccessibilityManager.getInstance(mContext); + if (accessibilityManager.isEnabled()) { + AccessibilityEvent event = AccessibilityEvent.obtain(type); + accessibilityManager.sendAccessibilityEvent(event); + } + } + + /** * Sends down events to the view hierarchy for all active pointers which are * not already being delivered i.e. pointers that are not yet injected. * @@ -807,7 +877,8 @@ class TouchExplorer implements EventStreamTransformation { MotionEvent event = mInjectedPointerTracker.getLastInjectedHoverEvent(); if (event != null && event.getActionMasked() != MotionEvent.ACTION_HOVER_EXIT) { final int pointerIdBits = event.getPointerIdBits(); - mAms.touchExplorationGestureEnded(); + mTouchExplorationGestureEnded = true; + mTouchInteractionEnded = true; sendMotionEvent(event, MotionEvent.ACTION_HOVER_EXIT, pointerIdBits, policyFlags); } } @@ -822,7 +893,6 @@ class TouchExplorer implements EventStreamTransformation { MotionEvent event = mInjectedPointerTracker.getLastInjectedHoverEvent(); if (event != null && event.getActionMasked() == MotionEvent.ACTION_HOVER_EXIT) { final int pointerIdBits = event.getPointerIdBits(); - mAms.touchExplorationGestureStarted(); sendMotionEvent(event, MotionEvent.ACTION_HOVER_ENTER, pointerIdBits, policyFlags); } } @@ -1080,16 +1150,24 @@ class TouchExplorer implements EventStreamTransformation { return; } + if (Build.IS_DEBUGGABLE) { + if (mSendHoverEnterDelayed.isPending()) { + throw new IllegalStateException("mSendHoverEnterDelayed must not be pending."); + } + if (mSendHoverExitDelayed.isPending()) { + throw new IllegalStateException("mSendHoverExitDelayed must not be pending."); + } + if (!mPerformLongPressDelayed.isPending()) { + throw new IllegalStateException( + "mPerformLongPressDelayed must not be pending."); + } + } + // Remove pending event deliveries. - mSendHoverEnterDelayed.remove(); - mSendHoverExitDelayed.remove(); mPerformLongPressDelayed.remove(); - // This is a tap so do not send hover events since - // this events will result in firing the corresponding - // accessibility events confusing the user about what - // is actually clicked. - sendExitEventsIfNeeded(policyFlags); + // The touch interaction has ended since we will send a click. + sendAccessibilityEvent(AccessibilityEvent.TYPE_TOUCH_INTERACTION_END); int clickLocationX; int clickLocationY; @@ -1257,13 +1335,13 @@ class TouchExplorer implements EventStreamTransformation { } public void remove() { - if (isPenidng()) { + if (isPending()) { mHandler.removeCallbacks(this); clear(); } } - private boolean isPenidng() { + public boolean isPending() { return (mEvent != null); } @@ -1326,7 +1404,7 @@ class TouchExplorer implements EventStreamTransformation { } private void clear() { - if (!isPenidng()) { + if (!isPending()) { return; } mEvent.recycle(); @@ -1347,15 +1425,18 @@ class TouchExplorer implements EventStreamTransformation { private MotionEvent mPrototype; private int mPointerIdBits; private int mPolicyFlags; + private boolean mTouchExplorationInProgress; public SendHoverDelayed(int hoverAction, boolean gestureStarted) { mHoverAction = hoverAction; mGestureStarted = gestureStarted; } - public void post(MotionEvent prototype, int pointerIdBits, int policyFlags) { + public void post(MotionEvent prototype, boolean touchExplorationInProgress, + int pointerIdBits, int policyFlags) { remove(); mPrototype = MotionEvent.obtain(prototype); + mTouchExplorationInProgress = touchExplorationInProgress; mPointerIdBits = pointerIdBits; mPolicyFlags = policyFlags; mHandler.postDelayed(this, mDetermineUserIntentTimeout); @@ -1392,6 +1473,7 @@ class TouchExplorer implements EventStreamTransformation { mPrototype = null; mPointerIdBits = -1; mPolicyFlags = 0; + mTouchExplorationInProgress = false; } public void forceSendAndRemove() { @@ -1408,10 +1490,17 @@ class TouchExplorer implements EventStreamTransformation { Slog.d(LOG_TAG_SEND_HOVER_DELAYED, mGestureStarted ? "touchExplorationGestureStarted" : "touchExplorationGestureEnded"); } - if (mGestureStarted) { - mAms.touchExplorationGestureStarted(); + if (mTouchExplorationInProgress) { + if (mGestureStarted) { + sendAccessibilityEvent(AccessibilityEvent.TYPE_TOUCH_EXPLORATION_GESTURE_START); + } else { + mTouchExplorationGestureEnded = true; + mTouchInteractionEnded = true; + } } else { - mAms.touchExplorationGestureEnded(); + if (!mGestureStarted) { + mTouchInteractionEnded = true; + } } sendMotionEvent(mPrototype, mHoverAction, mPointerIdBits, mPolicyFlags); clear(); diff --git a/services/java/com/android/server/pm/PackageManagerService.java b/services/java/com/android/server/pm/PackageManagerService.java index e208068ec60e..2ef1f9ed0749 100644 --- a/services/java/com/android/server/pm/PackageManagerService.java +++ b/services/java/com/android/server/pm/PackageManagerService.java @@ -5664,6 +5664,8 @@ public class PackageManagerService extends IPackageManager.Stub { filteredFlags = flags & ~PackageManager.INSTALL_FROM_ADB; } + verificationParams.setInstallerUid(uid); + final Message msg = mHandler.obtainMessage(INIT_COPY); msg.obj = new InstallParams(packageURI, observer, filteredFlags, installerPackageName, verificationParams, encryptionParams, user); @@ -5902,9 +5904,12 @@ public class PackageManagerService extends IPackageManager.Stub { * @return true if verification should be performed */ private boolean isVerificationEnabled() { + if (!DEFAULT_VERIFY_ENABLE) { + return false; + } + return android.provider.Settings.Global.getInt(mContext.getContentResolver(), - android.provider.Settings.Global.PACKAGE_VERIFIER_ENABLE, - DEFAULT_VERIFY_ENABLE ? 1 : 0) == 1 ? true : false; + android.provider.Settings.Global.PACKAGE_VERIFIER_ENABLE, 1) == 1; } /** @@ -6425,6 +6430,12 @@ public class PackageManagerService extends IPackageManager.Stub { verification.putExtra(PackageManager.EXTRA_VERIFICATION_INSTALL_FLAGS, flags); + verification.putExtra(PackageManager.EXTRA_VERIFICATION_PACKAGE_NAME, + pkgLite.packageName); + + verification.putExtra(PackageManager.EXTRA_VERIFICATION_VERSION_CODE, + pkgLite.versionCode); + if (verificationParams != null) { if (verificationParams.getVerificationURI() != null) { verification.putExtra(PackageManager.EXTRA_VERIFICATION_URI, @@ -6438,6 +6449,10 @@ public class PackageManagerService extends IPackageManager.Stub { verification.putExtra(Intent.EXTRA_REFERRER, verificationParams.getReferrer()); } + if (verificationParams.getInstallerUid() >= 0) { + verification.putExtra(PackageManager.EXTRA_VERIFICATION_INSTALLER_UID, + verificationParams.getInstallerUid()); + } } final PackageVerificationState verificationState = new PackageVerificationState( diff --git a/wifi/java/android/net/wifi/WifiNative.java b/wifi/java/android/net/wifi/WifiNative.java index 805faa636373..4c5fc5d07410 100644 --- a/wifi/java/android/net/wifi/WifiNative.java +++ b/wifi/java/android/net/wifi/WifiNative.java @@ -49,6 +49,7 @@ public class WifiNative { static final int BLUETOOTH_COEXISTENCE_MODE_SENSE = 2; String mInterface = ""; + private boolean mSuspendOptEnabled = false; public native static boolean loadDriver(); @@ -349,6 +350,8 @@ public class WifiNative { } public boolean setSuspendOptimizations(boolean enabled) { + if (mSuspendOptEnabled == enabled) return true; + mSuspendOptEnabled = enabled; if (enabled) { return doBooleanCommand("DRIVER SETSUSPENDMODE 1"); } else { diff --git a/wifi/java/android/net/wifi/WifiStateMachine.java b/wifi/java/android/net/wifi/WifiStateMachine.java index 517f5972a274..c6bb069f8f7d 100644 --- a/wifi/java/android/net/wifi/WifiStateMachine.java +++ b/wifi/java/android/net/wifi/WifiStateMachine.java @@ -141,8 +141,6 @@ public class WifiStateMachine extends StateMachine { private boolean mBluetoothConnectionActive = false; - private BroadcastReceiver mScreenReceiver; - private IntentFilter mScreenFilter; private PowerManager.WakeLock mSuspendWakeLock; /** @@ -628,15 +626,16 @@ public class WifiStateMachine extends StateMachine { }, new IntentFilter(ACTION_START_SCAN)); - mScreenFilter = new IntentFilter(); - mScreenFilter.addAction(Intent.ACTION_SCREEN_ON); - mScreenFilter.addAction(Intent.ACTION_SCREEN_OFF); - mScreenReceiver = new BroadcastReceiver() { + IntentFilter screenFilter = new IntentFilter(); + screenFilter.addAction(Intent.ACTION_SCREEN_ON); + screenFilter.addAction(Intent.ACTION_SCREEN_OFF); + BroadcastReceiver screenReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (action.equals(Intent.ACTION_SCREEN_ON)) { + if (DBG) log("ACTION_SCREEN_ON"); enableRssiPolling(true); if (mBackgroundScanSupported) { enableBackgroundScanCommand(false); @@ -647,6 +646,7 @@ public class WifiStateMachine extends StateMachine { sendMessage(obtainMessage(CMD_SET_SUSPEND_OPT_ENABLED, 0, 0)); } } else if (action.equals(Intent.ACTION_SCREEN_OFF)) { + if (DBG) log("ACTION_SCREEN_OFF"); enableRssiPolling(false); if (mBackgroundScanSupported) { enableBackgroundScanCommand(true); @@ -660,6 +660,7 @@ public class WifiStateMachine extends StateMachine { } } }; + mContext.registerReceiver(screenReceiver, screenFilter); mContext.registerReceiver( new BroadcastReceiver() { @@ -1335,12 +1336,10 @@ public class WifiStateMachine extends StateMachine { /* None of dhcp, screen or highperf need it disabled and user wants it enabled */ if (mSuspendOptNeedsDisabled == 0 && mUserWantsSuspendOpt.get()) { mWifiNative.setSuspendOptimizations(true); - if (DBG) log("Enabled, mSuspendOptNeedsDisabled " + mSuspendOptNeedsDisabled); } } else { mSuspendOptNeedsDisabled |= reason; mWifiNative.setSuspendOptimizations(false); - if (DBG) log("Disabled, mSuspendOptNeedsDisabled " + mSuspendOptNeedsDisabled); } } @@ -2723,8 +2722,6 @@ public class WifiStateMachine extends StateMachine { } if (mP2pSupported) mWifiP2pChannel.sendMessage(WifiStateMachine.CMD_ENABLE_P2P); - - mContext.registerReceiver(mScreenReceiver, mScreenFilter); } @Override public boolean processMessage(Message message) { @@ -2861,7 +2858,6 @@ public class WifiStateMachine extends StateMachine { mScanResults = new ArrayList<ScanResult>(); if (mP2pSupported) mWifiP2pChannel.sendMessage(WifiStateMachine.CMD_DISABLE_P2P); - mContext.unregisterReceiver(mScreenReceiver); } } diff --git a/wifi/java/android/net/wifi/p2p/WifiP2pService.java b/wifi/java/android/net/wifi/p2p/WifiP2pService.java index 3575d9758681..edd1dac8b56b 100644 --- a/wifi/java/android/net/wifi/p2p/WifiP2pService.java +++ b/wifi/java/android/net/wifi/p2p/WifiP2pService.java @@ -135,7 +135,7 @@ public class WifiP2pService extends IWifiP2pManager.Stub { private static final int DISCOVER_TIMEOUT_S = 120; /* Idle time after a peer is gone when the group is torn down */ - private static final int GROUP_IDLE_TIME_S = 2; + private static final int GROUP_IDLE_TIME_S = 5; /** * Delay between restarts upon failure to setup connection with supplicant |