diff options
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/app/ActivityManager.java | 8 | ||||
| -rw-r--r-- | core/java/android/app/ApplicationErrorReport.java | 2 | ||||
| -rw-r--r-- | core/java/android/app/Notification.java | 25 | ||||
| -rw-r--r-- | core/java/android/hardware/camera2/legacy/LegacyMetadataMapper.java | 8 | ||||
| -rw-r--r-- | core/java/android/hardware/camera2/legacy/RequestThreadManager.java | 20 | ||||
| -rw-r--r-- | core/java/android/os/Binder.java | 18 | ||||
| -rw-r--r-- | core/java/android/os/StrictMode.java | 9 | ||||
| -rw-r--r-- | core/java/android/service/notification/NotificationListenerService.java | 3 | ||||
| -rw-r--r-- | core/java/android/view/AccessibilityManagerInternal.java | 31 | ||||
| -rw-r--r-- | core/java/android/view/View.java | 1 | ||||
| -rw-r--r-- | core/java/android/widget/FrameLayout.java | 10 | ||||
| -rw-r--r-- | core/java/com/android/internal/widget/LockPatternUtils.java | 24 |
12 files changed, 140 insertions, 19 deletions
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java index 3d14c58..cd6088f 100644 --- a/core/java/android/app/ActivityManager.java +++ b/core/java/android/app/ActivityManager.java @@ -579,7 +579,7 @@ public class ActivityManager { public TaskDescription(TaskDescription td) { mLabel = td.mLabel; mIcon = td.mIcon; - setPrimaryColor(td.mColorPrimary); + mColorPrimary = td.mColorPrimary; mIconFilename = td.mIconFilename; } @@ -600,7 +600,11 @@ public class ActivityManager { * @hide */ public void setPrimaryColor(int primaryColor) { - mColorPrimary = 0xFF000000 | primaryColor; + // Ensure that the given color is valid + if ((primaryColor != 0) && (Color.alpha(primaryColor) != 255)) { + throw new RuntimeException("A TaskDescription's primary color should be opaque"); + } + mColorPrimary = primaryColor; } /** diff --git a/core/java/android/app/ApplicationErrorReport.java b/core/java/android/app/ApplicationErrorReport.java index be4e80e..841bd16 100644 --- a/core/java/android/app/ApplicationErrorReport.java +++ b/core/java/android/app/ApplicationErrorReport.java @@ -388,7 +388,7 @@ public class ApplicationErrorReport implements Parcelable { dest.writeInt(throwLineNumber); dest.writeString(stackTrace); int total = dest.dataPosition()-start; - if (total > 100*1024) { + if (total > 10*1024) { Slog.d("Error", "ERR: exClass=" + exceptionClassName); Slog.d("Error", "ERR: exMsg=" + exceptionMessage); Slog.d("Error", "ERR: file=" + throwFileName); diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index 31b39eb..4b3aefe 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -798,8 +798,8 @@ public class Notification implements Parcelable public static final String EXTRA_TEMPLATE = "android.template"; /** - * {@link #extras} key: An array of people that this notification relates to, specified - * by contacts provider contact URI. + * {@link #extras} key: A String array containing the people that this notification relates to, + * each of which was supplied to {@link Builder#addPerson(String)}. */ public static final String EXTRA_PEOPLE = "android.people"; @@ -2393,10 +2393,27 @@ public class Notification implements Parcelable /** * Add a person that is relevant to this notification. * + * <P> + * Depending on user preferences, this annotation may allow the notification to pass + * through interruption filters, and to appear more prominently in the user interface. + * </P> + * + * <P> + * The person should be specified by the {@code String} representation of a + * {@link android.provider.ContactsContract.Contacts#CONTENT_LOOKUP_URI}. + * </P> + * + * <P>The system will also attempt to resolve {@code mailto:} and {@code tel:} schema + * URIs. The path part of these URIs must exist in the contacts database, in the + * appropriate column, or the reference will be discarded as invalid. Telephone schema + * URIs will be resolved by {@link android.provider.ContactsContract.PhoneLookup}. + * </P> + * + * @param uri A URI for the person. * @see Notification#EXTRA_PEOPLE */ - public Builder addPerson(String handle) { - mPeople.add(handle); + public Builder addPerson(String uri) { + mPeople.add(uri); return this; } diff --git a/core/java/android/hardware/camera2/legacy/LegacyMetadataMapper.java b/core/java/android/hardware/camera2/legacy/LegacyMetadataMapper.java index 618195a..03540e1 100644 --- a/core/java/android/hardware/camera2/legacy/LegacyMetadataMapper.java +++ b/core/java/android/hardware/camera2/legacy/LegacyMetadataMapper.java @@ -1350,6 +1350,14 @@ public class LegacyMetadataMapper { m.set(CaptureRequest.LENS_FOCAL_LENGTH, c.get(CameraCharacteristics.LENS_INFO_AVAILABLE_FOCAL_LENGTHS)[0]); + /* + * jpeg.* + */ + + // jpeg.thumbnailSize - set smallest non-zero size if possible + Size[] sizes = c.get(CameraCharacteristics.JPEG_AVAILABLE_THUMBNAIL_SIZES); + m.set(CaptureRequest.JPEG_THUMBNAIL_SIZE, (sizes.length > 1) ? sizes[1] : sizes[0]); + // TODO: map other request template values return m; } diff --git a/core/java/android/hardware/camera2/legacy/RequestThreadManager.java b/core/java/android/hardware/camera2/legacy/RequestThreadManager.java index fd95901..35deb71 100644 --- a/core/java/android/hardware/camera2/legacy/RequestThreadManager.java +++ b/core/java/android/hardware/camera2/legacy/RequestThreadManager.java @@ -16,11 +16,13 @@ package android.hardware.camera2.legacy; +import android.graphics.ImageFormat; import android.graphics.SurfaceTexture; import android.hardware.Camera; import android.hardware.camera2.CameraCharacteristics; import android.hardware.camera2.CaptureRequest; import android.hardware.camera2.impl.CameraDeviceImpl; +import android.hardware.camera2.params.StreamConfigurationMap; import android.hardware.camera2.utils.LongParcelable; import android.hardware.camera2.utils.SizeAreaComparator; import android.hardware.camera2.impl.CameraMetadataNative; @@ -36,6 +38,7 @@ import android.view.Surface; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.List; @@ -208,18 +211,23 @@ public class RequestThreadManager { int totalSize = data.length + LegacyCameraDevice.nativeGetJpegFooterSize(); totalSize = (totalSize + 3) & ~0x3; // round up to nearest octonibble + LegacyCameraDevice.setNextTimestamp(s, timestamp); if (USE_BLOB_FORMAT_OVERRIDE) { // Override to RGBA_8888 format. LegacyCameraDevice.setSurfaceFormat(s, LegacyMetadataMapper.HAL_PIXEL_FORMAT_RGBA_8888); - // divide by 4 if using RGBA format (width is in pixels, not bytes). - totalSize >>= 2; + + int dimen = (int) Math.ceil(Math.sqrt(totalSize)); + dimen = (dimen + 0xf) & ~0xf; // round up to nearest multiple of 16 + LegacyCameraDevice.setSurfaceDimens(s, dimen, dimen); + LegacyCameraDevice.produceFrame(s, data, dimen, dimen, + CameraMetadataNative.NATIVE_JPEG_FORMAT); + } else { + LegacyCameraDevice.setSurfaceDimens(s, totalSize, /*height*/1); + LegacyCameraDevice.produceFrame(s, data, totalSize, /*height*/1, + CameraMetadataNative.NATIVE_JPEG_FORMAT); } - LegacyCameraDevice.setSurfaceDimens(s, totalSize, /*height*/1); - LegacyCameraDevice.setNextTimestamp(s, timestamp); - LegacyCameraDevice.produceFrame(s, data, totalSize, /*height*/1, - CameraMetadataNative.NATIVE_JPEG_FORMAT); } } catch (LegacyExceptionUtils.BufferQueueAbandonedException e) { Log.w(TAG, "Surface abandoned, dropping frame. ", e); diff --git a/core/java/android/os/Binder.java b/core/java/android/os/Binder.java index f5fc0d7..bbf6ed8 100644 --- a/core/java/android/os/Binder.java +++ b/core/java/android/os/Binder.java @@ -430,16 +430,18 @@ public class Binder implements IBinder { } catch (RemoteException e) { if ((flags & FLAG_ONEWAY) != 0) { Log.w(TAG, "Binder call failed.", e); + } else { + reply.setDataPosition(0); + reply.writeException(e); } - reply.setDataPosition(0); - reply.writeException(e); res = true; } catch (RuntimeException e) { if ((flags & FLAG_ONEWAY) != 0) { Log.w(TAG, "Caught a RuntimeException from the binder stub implementation.", e); + } else { + reply.setDataPosition(0); + reply.writeException(e); } - reply.setDataPosition(0); - reply.writeException(e); res = true; } catch (OutOfMemoryError e) { // Unconditionally log this, since this is generally unrecoverable. @@ -452,6 +454,14 @@ public class Binder implements IBinder { checkParcel(this, code, reply, "Unreasonably large binder reply buffer"); reply.recycle(); data.recycle(); + + // Just in case -- we are done with the IPC, so there should be no more strict + // mode violations that have gathered for this thread. Either they have been + // parceled and are now in transport off to the caller, or we are returning back + // to the main transaction loop to wait for another incoming transaction. Either + // way, strict mode begone! + StrictMode.clearGatheredViolations(); + return res; } } diff --git a/core/java/android/os/StrictMode.java b/core/java/android/os/StrictMode.java index 4e9d1f0..0e561bd 100644 --- a/core/java/android/os/StrictMode.java +++ b/core/java/android/os/StrictMode.java @@ -1693,7 +1693,7 @@ public final class StrictMode { int start = p.dataPosition(); violations.get(i).writeToParcel(p, 0 /* unused flags? */); int size = p.dataPosition()-start; - if (size > 100*1024) { + if (size > 10*1024) { Slog.d(TAG, "Wrote violation #" + i + " of " + violations.size() + ": " + (p.dataPosition()-start) + " bytes"); } @@ -1725,6 +1725,11 @@ public final class StrictMode { for (int i = 0; i < numViolations; ++i) { if (LOG_V) Log.d(TAG, "strict mode violation stacks read from binder call. i=" + i); ViolationInfo info = new ViolationInfo(p, !currentlyGathering); + if (info.crashInfo.stackTrace.length() > 5000) { + RuntimeException here = new RuntimeException("here"); + here.fillInStackTrace(); + Slog.w(TAG, "Stack is getting large: " + info.crashInfo.stackTrace, here); + } info.crashInfo.stackTrace += "# via Binder call with stack:\n" + ourStack; BlockGuard.Policy policy = BlockGuard.getThreadPolicy(); if (policy instanceof AndroidBlockGuardPolicy) { @@ -2194,7 +2199,7 @@ public final class StrictMode { dest.writeString(broadcastIntentAction); dest.writeStringArray(tags); int total = dest.dataPosition()-start; - if (total > 100*1024) { + if (total > 10*1024) { Slog.d(TAG, "VIO: policy=" + policy + " dur=" + durationMillis + " numLoop=" + violationNumThisLoop + " anim=" + numAnimationsRunning diff --git a/core/java/android/service/notification/NotificationListenerService.java b/core/java/android/service/notification/NotificationListenerService.java index 35fff74..5d6acd8 100644 --- a/core/java/android/service/notification/NotificationListenerService.java +++ b/core/java/android/service/notification/NotificationListenerService.java @@ -760,6 +760,9 @@ public abstract class NotificationListenerService extends Service { /** * Returns whether the notification matches the user's interruption * filter. + * + * @return {@code true} if the notification is allowed by the filter, or + * {@code false} if it is blocked. */ public boolean matchesInterruptionFilter() { return mMatchesInterruptionFilter; diff --git a/core/java/android/view/AccessibilityManagerInternal.java b/core/java/android/view/AccessibilityManagerInternal.java new file mode 100644 index 0000000..7bb2dc5 --- /dev/null +++ b/core/java/android/view/AccessibilityManagerInternal.java @@ -0,0 +1,31 @@ +/* + * 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 android.view; + +/** + * Accessibility manager local system service interface. + * + * @hide Only for use within the system server. + */ +public abstract class AccessibilityManagerInternal { + + /** + * Queries if the accessibility manager service permits setting + * a non-default encryption password. + */ + public abstract boolean isNonDefaultEncryptionPasswordAllowed(); +} diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 83dfe85..b454681 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -6601,6 +6601,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * @see #fitSystemWindows(Rect) * @see #setSystemUiVisibility(int) */ + @ViewDebug.ExportedProperty public boolean getFitsSystemWindows() { return (mViewFlags & FITS_SYSTEM_WINDOWS) == FITS_SYSTEM_WINDOWS; } diff --git a/core/java/android/widget/FrameLayout.java b/core/java/android/widget/FrameLayout.java index 235e79f..e317524 100644 --- a/core/java/android/widget/FrameLayout.java +++ b/core/java/android/widget/FrameLayout.java @@ -29,6 +29,7 @@ import android.graphics.Region; import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.view.Gravity; +import android.view.RemotableViewMethod; import android.view.View; import android.view.ViewDebug; import android.view.ViewGroup; @@ -201,6 +202,15 @@ public class FrameLayout extends ViewGroup { } } + @Override + @RemotableViewMethod + public void setVisibility(@Visibility int visibility) { + super.setVisibility(visibility); + if (mForeground != null) { + mForeground.setVisible(visibility == VISIBLE, false); + } + } + /** * {@inheritDoc} */ diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java index 16fa88e..2b7af4b 100644 --- a/core/java/com/android/internal/widget/LockPatternUtils.java +++ b/core/java/com/android/internal/widget/LockPatternUtils.java @@ -878,6 +878,30 @@ public class LockPatternUtils { } /** + * Gets whether the device is encrypted. + * + * @return Whether the device is encrypted. + */ + public static boolean isDeviceEncrypted() { + IMountService mountService = IMountService.Stub.asInterface( + ServiceManager.getService("mount")); + try { + return mountService.getEncryptionState() != IMountService.ENCRYPTION_STATE_NONE + && mountService.getPasswordType() != StorageManager.CRYPT_TYPE_DEFAULT; + } catch (RemoteException re) { + Log.e(TAG, "Error getting encryption state", re); + } + return true; + } + + /** + * Clears the encryption password. + */ + public void clearEncryptionPassword() { + updateEncryptionPassword(StorageManager.CRYPT_TYPE_DEFAULT, null); + } + + /** * Retrieves the quality mode we're in. * {@see DevicePolicyManager#getPasswordQuality(android.content.ComponentName)} * |
