summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--api/current.txt1
-rw-r--r--api/system-current.txt1
-rw-r--r--cmds/screencap/screencap.cpp29
-rw-r--r--core/java/android/hardware/camera2/CameraCaptureSession.java25
-rw-r--r--core/java/android/provider/DocumentsContract.java6
-rw-r--r--core/java/android/service/notification/NotificationListenerService.java2
-rw-r--r--core/java/android/view/SurfaceView.java2
-rw-r--r--packages/DocumentsUI/src/com/android/documentsui/BaseActivity.java43
-rw-r--r--packages/DocumentsUI/src/com/android/documentsui/DocumentsActivity.java2
-rw-r--r--packages/DocumentsUI/src/com/android/documentsui/RootsCache.java6
-rw-r--r--packages/DocumentsUI/src/com/android/documentsui/model/RootInfo.java2
-rw-r--r--packages/DocumentsUI/tests/src/com/android/documentsui/RootsCacheTest.java25
-rw-r--r--packages/SystemUI/res/layout-sw600dp/navigation_bar.xml38
-rw-r--r--packages/SystemUI/res/layout/navigation_bar.xml42
-rw-r--r--packages/SystemUI/res/layout/volume_dialog_row.xml6
-rw-r--r--packages/SystemUI/res/values/styles.xml5
-rw-r--r--packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java41
-rw-r--r--services/core/java/com/android/server/ConnectivityService.java5
-rw-r--r--services/tests/servicestests/src/com/android/server/ConnectivityServiceTest.java21
19 files changed, 233 insertions, 69 deletions
diff --git a/api/current.txt b/api/current.txt
index 049d7907f5ef..6cd3932283a2 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -26099,6 +26099,7 @@ package android.provider {
method public static boolean isDocumentUri(android.content.Context, android.net.Uri);
method public static android.net.Uri renameDocument(android.content.ContentResolver, android.net.Uri, java.lang.String);
field public static final java.lang.String EXTRA_ERROR = "error";
+ field public static final java.lang.String EXTRA_EXCLUDE_SELF = "android.provider.extra.EXCLUDE_SELF";
field public static final java.lang.String EXTRA_INFO = "info";
field public static final java.lang.String EXTRA_LOADING = "loading";
field public static final java.lang.String PROVIDER_INTERFACE = "android.content.action.DOCUMENTS_PROVIDER";
diff --git a/api/system-current.txt b/api/system-current.txt
index 8b3c1819e17a..810bed45d0cc 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -28029,6 +28029,7 @@ package android.provider {
method public static boolean isDocumentUri(android.content.Context, android.net.Uri);
method public static android.net.Uri renameDocument(android.content.ContentResolver, android.net.Uri, java.lang.String);
field public static final java.lang.String EXTRA_ERROR = "error";
+ field public static final java.lang.String EXTRA_EXCLUDE_SELF = "android.provider.extra.EXCLUDE_SELF";
field public static final java.lang.String EXTRA_INFO = "info";
field public static final java.lang.String EXTRA_LOADING = "loading";
field public static final java.lang.String PROVIDER_INTERFACE = "android.content.action.DOCUMENTS_PROVIDER";
diff --git a/cmds/screencap/screencap.cpp b/cmds/screencap/screencap.cpp
index dbc35af2c22d..c469ae4a0961 100644
--- a/cmds/screencap/screencap.cpp
+++ b/cmds/screencap/screencap.cpp
@@ -30,6 +30,7 @@
#include <gui/SurfaceComposerClient.h>
#include <gui/ISurfaceComposer.h>
+#include <ui/DisplayInfo.h>
#include <ui/PixelFormat.h>
// TODO: Fix Skia.
@@ -159,9 +160,35 @@ int main(int argc, char** argv)
uint32_t w, s, h, f;
size_t size = 0;
+ // Maps orientations from DisplayInfo to ISurfaceComposer
+ static const uint32_t ORIENTATION_MAP[] = {
+ ISurfaceComposer::eRotateNone, // 0 == DISPLAY_ORIENTATION_0
+ ISurfaceComposer::eRotate270, // 1 == DISPLAY_ORIENTATION_90
+ ISurfaceComposer::eRotate180, // 2 == DISPLAY_ORIENTATION_180
+ ISurfaceComposer::eRotate90, // 3 == DISPLAY_ORIENTATION_270
+ };
+
ScreenshotClient screenshot;
sp<IBinder> display = SurfaceComposerClient::getBuiltInDisplay(displayId);
- if (display != NULL && screenshot.update(display, Rect(), false) == NO_ERROR) {
+ if (display == NULL) {
+ fprintf(stderr, "Unable to get handle for display %d\n", displayId);
+ return 1;
+ }
+
+ Vector<DisplayInfo> configs;
+ SurfaceComposerClient::getDisplayConfigs(display, &configs);
+ int activeConfig = SurfaceComposerClient::getActiveConfig(display);
+ if (static_cast<size_t>(activeConfig) >= configs.size()) {
+ fprintf(stderr, "Active config %d not inside configs (size %zu)\n",
+ activeConfig, configs.size());
+ return 1;
+ }
+ uint8_t displayOrientation = configs[activeConfig].orientation;
+ uint32_t captureOrientation = ORIENTATION_MAP[displayOrientation];
+
+ status_t result = screenshot.update(display, Rect(), 0, 0, 0, -1U,
+ false, captureOrientation);
+ if (result == NO_ERROR) {
base = screenshot.getPixels();
w = screenshot.getWidth();
h = screenshot.getHeight();
diff --git a/core/java/android/hardware/camera2/CameraCaptureSession.java b/core/java/android/hardware/camera2/CameraCaptureSession.java
index 82d40d3e5d23..c547b06d72b0 100644
--- a/core/java/android/hardware/camera2/CameraCaptureSession.java
+++ b/core/java/android/hardware/camera2/CameraCaptureSession.java
@@ -150,9 +150,17 @@ public abstract class CameraCaptureSession implements AutoCloseable {
* {@link CaptureRequest.Builder#addTarget}) must be a subset of the surfaces provided when this
* capture session was created.</p>
*
- * <p>Multiple requests can be in progress at once. They are processed in
- * first-in, first-out order, with minimal delays between each
- * capture. Requests submitted through this method have higher priority than
+ * <p>Multiple regular and reprocess requests can be in progress at once. If there are only
+ * regular requests or reprocess requests in progress, they are processed in first-in,
+ * first-out order. If there are both regular and reprocess requests in progress, regular
+ * requests are processed in first-in, first-out order and reprocess requests are processed in
+ * first-in, first-out order, respectively. However, the processing order of a regular request
+ * and a reprocess request in progress is not specified. In other words, a regular request
+ * will always be processed before regular requets that are submitted later. A reprocess request
+ * will always be processed before reprocess requests that are submitted later. However, a
+ * regular request may not be processed before reprocess requests that are submitted later.<p>
+ *
+ * <p>Requests submitted through this method have higher priority than
* those submitted through {@link #setRepeatingRequest} or
* {@link #setRepeatingBurst}, and will be processed as soon as the current
* repeat/repeatBurst processing completes.</p>
@@ -207,10 +215,13 @@ public abstract class CameraCaptureSession implements AutoCloseable {
* not be interleaved with requests submitted by other capture or repeat
* calls.
*
- * <p>The requests will be captured in order, each capture producing one {@link CaptureResult}
- * and image buffers for one or more target {@link android.view.Surface surfaces}. The target
- * surfaces (set with {@link CaptureRequest.Builder#addTarget}) must be a subset of the surfaces
- * provided when this capture session was created.</p>
+ * <p>Regular and reprocess requests can be mixed together in a single burst. Regular requests
+ * will be captured in order and reprocess requests will be processed in order, respectively.
+ * However, the processing order between a regular request and a reprocess request is not
+ * specified. Each capture produces one {@link CaptureResult} and image buffers for one or more
+ * target {@link android.view.Surface surfaces}. The target surfaces (set with
+ * {@link CaptureRequest.Builder#addTarget}) must be a subset of the surfaces provided when
+ * this capture session was created.</p>
*
* <p>The main difference between this method and simply calling
* {@link #capture} repeatedly is that this method guarantees that no
diff --git a/core/java/android/provider/DocumentsContract.java b/core/java/android/provider/DocumentsContract.java
index 69338b0655f6..30535ffbe8ef 100644
--- a/core/java/android/provider/DocumentsContract.java
+++ b/core/java/android/provider/DocumentsContract.java
@@ -93,6 +93,12 @@ public final class DocumentsContract {
public static final String EXTRA_SHOW_ADVANCED = "android.content.extra.SHOW_ADVANCED";
/**
+ * Set this in a DocumentsUI intent to cause a package's own roots to be
+ * excluded from the roots list.
+ */
+ public static final String EXTRA_EXCLUDE_SELF = "android.provider.extra.EXCLUDE_SELF";
+
+ /**
* Included in {@link AssetFileDescriptor#getExtras()} when returned
* thumbnail should be rotated.
*
diff --git a/core/java/android/service/notification/NotificationListenerService.java b/core/java/android/service/notification/NotificationListenerService.java
index b8493d4a05cf..8c6cd09a8144 100644
--- a/core/java/android/service/notification/NotificationListenerService.java
+++ b/core/java/android/service/notification/NotificationListenerService.java
@@ -646,7 +646,7 @@ public abstract class NotificationListenerService extends Service {
private void createLegacyIconExtras(Notification n) {
Icon smallIcon = n.getSmallIcon();
Icon largeIcon = n.getLargeIcon();
- if (smallIcon.getType() == Icon.TYPE_RESOURCE) {
+ if (smallIcon != null && smallIcon.getType() == Icon.TYPE_RESOURCE) {
n.extras.putInt(Notification.EXTRA_SMALL_ICON, smallIcon.getResId());
n.icon = smallIcon.getResId();
}
diff --git a/core/java/android/view/SurfaceView.java b/core/java/android/view/SurfaceView.java
index 160c66208e7f..7d48a9a11eda 100644
--- a/core/java/android/view/SurfaceView.java
+++ b/core/java/android/view/SurfaceView.java
@@ -523,7 +523,7 @@ public class SurfaceView extends View {
mVisibleInsets, mStableInsets, mOutsets, mConfiguration,
mNewSurface);
if ((relayoutResult & WindowManagerGlobal.RELAYOUT_RES_FIRST_TIME) != 0) {
- mReportDrawNeeded = true;
+ reportDrawNeeded = true;
}
if (DEBUG) Log.i(TAG, "New surface: " + mNewSurface
diff --git a/packages/DocumentsUI/src/com/android/documentsui/BaseActivity.java b/packages/DocumentsUI/src/com/android/documentsui/BaseActivity.java
index cb21131e0861..8ea581615806 100644
--- a/packages/DocumentsUI/src/com/android/documentsui/BaseActivity.java
+++ b/packages/DocumentsUI/src/com/android/documentsui/BaseActivity.java
@@ -25,6 +25,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.concurrent.Executor;
@@ -32,6 +33,10 @@ import libcore.io.IoUtils;
import android.app.Activity;
import android.app.Fragment;
import android.content.Intent;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+import android.content.pm.ProviderInfo;
import android.database.Cursor;
import android.net.Uri;
import android.os.AsyncTask;
@@ -232,9 +237,38 @@ abstract class BaseActivity extends Activity {
invalidateOptionsMenu();
}
+ final List<String> getExcludedAuthorities() {
+ List<String> authorities = new ArrayList<>();
+ if (getIntent().getBooleanExtra(DocumentsContract.EXTRA_EXCLUDE_SELF, false)) {
+ // Exclude roots provided by the calling package.
+ String packageName = getCallingPackageMaybeExtra();
+ try {
+ PackageInfo pkgInfo = getPackageManager().getPackageInfo(packageName,
+ PackageManager.GET_PROVIDERS);
+ for (ProviderInfo provider: pkgInfo.providers) {
+ authorities.add(provider.authority);
+ }
+ } catch (PackageManager.NameNotFoundException e) {
+ Log.e(mTag, "Calling package name does not resolve: " + packageName);
+ }
+ }
+ return authorities;
+ }
+
final String getCallingPackageMaybeExtra() {
- final String extra = getIntent().getStringExtra(DocumentsContract.EXTRA_PACKAGE_NAME);
- return (extra != null) ? extra : getCallingPackage();
+ String callingPackage = getCallingPackage();
+ // System apps can set the calling package name using an extra.
+ try {
+ ApplicationInfo info = getPackageManager().getApplicationInfo(callingPackage, 0);
+ if (info.isSystemApp() || info.isUpdatedSystemApp()) {
+ final String extra = getIntent().getStringExtra(DocumentsContract.EXTRA_PACKAGE_NAME);
+ if (extra != null) {
+ callingPackage = extra;
+ }
+ }
+ } finally {
+ return callingPackage;
+ }
}
public static BaseActivity get(Fragment fragment) {
@@ -287,6 +321,9 @@ abstract class BaseActivity extends Activity {
/** Currently copying file */
public List<DocumentInfo> selectedDocumentsForCopy = new ArrayList<DocumentInfo>();
+ /** Name of the package that started DocsUI */
+ public List<String> excludedAuthorities = new ArrayList<>();
+
public static final int ACTION_OPEN = 1;
public static final int ACTION_CREATE = 2;
public static final int ACTION_GET_CONTENT = 3;
@@ -327,6 +364,7 @@ abstract class BaseActivity extends Activity {
out.writeString(currentSearch);
out.writeMap(dirState);
out.writeList(selectedDocumentsForCopy);
+ out.writeList(excludedAuthorities);
}
public static final Creator<State> CREATOR = new Creator<State>() {
@@ -348,6 +386,7 @@ abstract class BaseActivity extends Activity {
state.currentSearch = in.readString();
in.readMap(state.dirState, null);
in.readList(state.selectedDocumentsForCopy, null);
+ in.readList(state.excludedAuthorities, null);
return state;
}
diff --git a/packages/DocumentsUI/src/com/android/documentsui/DocumentsActivity.java b/packages/DocumentsUI/src/com/android/documentsui/DocumentsActivity.java
index da59d0e3b1d1..69ae34e1a3b2 100644
--- a/packages/DocumentsUI/src/com/android/documentsui/DocumentsActivity.java
+++ b/packages/DocumentsUI/src/com/android/documentsui/DocumentsActivity.java
@@ -256,6 +256,8 @@ public class DocumentsActivity extends BaseActivity {
BaseActivity.DocumentsIntent.EXTRA_DIRECTORY_COPY, false);
}
+ state.excludedAuthorities = getExcludedAuthorities();
+
return state;
}
diff --git a/packages/DocumentsUI/src/com/android/documentsui/RootsCache.java b/packages/DocumentsUI/src/com/android/documentsui/RootsCache.java
index 27e8f207ab93..fbcb938692af 100644
--- a/packages/DocumentsUI/src/com/android/documentsui/RootsCache.java
+++ b/packages/DocumentsUI/src/com/android/documentsui/RootsCache.java
@@ -383,6 +383,12 @@ public class RootsCache {
continue;
}
+ // Exclude roots from the calling package.
+ if (state.excludedAuthorities.contains(root.authority)) {
+ if (LOGD) Log.d(TAG, "Excluding root " + root.authority + " from calling package.");
+ continue;
+ }
+
matching.add(root);
}
return matching;
diff --git a/packages/DocumentsUI/src/com/android/documentsui/model/RootInfo.java b/packages/DocumentsUI/src/com/android/documentsui/model/RootInfo.java
index 97d8ed0a2e4b..ecf4d6c3bc99 100644
--- a/packages/DocumentsUI/src/com/android/documentsui/model/RootInfo.java
+++ b/packages/DocumentsUI/src/com/android/documentsui/model/RootInfo.java
@@ -55,7 +55,6 @@ public class RootInfo implements Durable, Parcelable {
public String mimeTypes;
/** Derived fields that aren't persisted */
- public String derivedPackageName;
public String[] derivedMimeTypes;
public int derivedIcon;
@@ -75,7 +74,6 @@ public class RootInfo implements Durable, Parcelable {
availableBytes = -1;
mimeTypes = null;
- derivedPackageName = null;
derivedMimeTypes = null;
derivedIcon = 0;
}
diff --git a/packages/DocumentsUI/tests/src/com/android/documentsui/RootsCacheTest.java b/packages/DocumentsUI/tests/src/com/android/documentsui/RootsCacheTest.java
index 7faa3cebc898..8c5bac15442d 100644
--- a/packages/DocumentsUI/tests/src/com/android/documentsui/RootsCacheTest.java
+++ b/packages/DocumentsUI/tests/src/com/android/documentsui/RootsCacheTest.java
@@ -114,6 +114,31 @@ public class RootsCacheTest extends AndroidTestCase {
RootsCache.getMatchingRoots(mRoots, mState));
}
+ public void testExcludedAuthorities() throws Exception {
+ final List<RootInfo> roots = Lists.newArrayList();
+
+ // Set up some roots
+ for (int i = 0; i < 5; ++i) {
+ RootInfo root = new RootInfo();
+ root.authority = "authority" + i;
+ roots.add(root);
+ }
+ // Make some allowed authorities
+ List<RootInfo> allowedRoots = Lists.newArrayList(
+ roots.get(0), roots.get(2), roots.get(4));
+ // Set up the excluded authority list
+ for (RootInfo root: roots) {
+ if (!allowedRoots.contains(root)) {
+ mState.excludedAuthorities.add(root.authority);
+ }
+ }
+ mState.acceptMimes = new String[] { "*/*" };
+
+ assertContainsExactly(
+ allowedRoots,
+ RootsCache.getMatchingRoots(roots, mState));
+ }
+
private static void assertContainsExactly(List<?> expected, List<?> actual) {
assertEquals(expected.size(), actual.size());
for (Object o : expected) {
diff --git a/packages/SystemUI/res/layout-sw600dp/navigation_bar.xml b/packages/SystemUI/res/layout-sw600dp/navigation_bar.xml
index 456d2f9f9a9a..9912343acd17 100644
--- a/packages/SystemUI/res/layout-sw600dp/navigation_bar.xml
+++ b/packages/SystemUI/res/layout-sw600dp/navigation_bar.xml
@@ -3,16 +3,16 @@
**
** Copyright 2012, The Android Open Source Project
**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
+** 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
+** 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
+** 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.
-->
@@ -48,7 +48,7 @@
android:layout_marginStart="2dp"
android:visibility="invisible"
/>
- <Space
+ <Space
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
@@ -80,7 +80,7 @@
android:layout_weight="0"
android:contentDescription="@string/accessibility_recent"
/>
- <Space
+ <Space
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
@@ -120,7 +120,7 @@
android:id="@+id/lights_out"
android:visibility="gone"
>
- <Space
+ <Space
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
@@ -132,6 +132,7 @@
android:src="@drawable/ic_sysbar_lights_out_dot_small"
android:scaleType="center"
android:layout_weight="0"
+ android:contentDescription="@string/accessibility_back"
/>
<ImageView
android:layout_width="128dp" android:paddingStart="25dp" android:paddingEnd="25dp"
@@ -139,6 +140,7 @@
android:src="@drawable/ic_sysbar_lights_out_dot_large"
android:scaleType="center"
android:layout_weight="0"
+ android:contentDescription="@string/accessibility_home"
/>
<ImageView
android:layout_width="128dp" android:paddingStart="25dp" android:paddingEnd="25dp"
@@ -147,8 +149,9 @@
android:src="@drawable/ic_sysbar_lights_out_dot_small"
android:scaleType="center"
android:layout_weight="0"
+ android:contentDescription="@string/accessibility_recent"
/>
- <Space
+ <Space
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
@@ -193,7 +196,7 @@
android:layout_marginStart="2dp"
android:visibility="invisible"
/>
- <Space
+ <Space
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
@@ -225,7 +228,7 @@
android:layout_weight="0"
android:contentDescription="@string/accessibility_recent"
/>
- <Space
+ <Space
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
@@ -264,7 +267,7 @@
android:id="@+id/lights_out"
android:visibility="gone"
>
- <Space
+ <Space
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
@@ -276,6 +279,7 @@
android:src="@drawable/ic_sysbar_lights_out_dot_small"
android:scaleType="center"
android:layout_weight="0"
+ android:contentDescription="@string/accessibility_back"
/>
<ImageView
android:layout_width="162dp" android:paddingStart="42dp" android:paddingEnd="42dp"
@@ -283,6 +287,7 @@
android:src="@drawable/ic_sysbar_lights_out_dot_large"
android:scaleType="center"
android:layout_weight="0"
+ android:contentDescription="@string/accessibility_home"
/>
<ImageView
android:layout_width="162dp" android:paddingStart="42dp" android:paddingEnd="42dp"
@@ -291,8 +296,9 @@
android:src="@drawable/ic_sysbar_lights_out_dot_small"
android:scaleType="center"
android:layout_weight="0"
+ android:contentDescription="@string/accessibility_recent"
/>
- <Space
+ <Space
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
diff --git a/packages/SystemUI/res/layout/navigation_bar.xml b/packages/SystemUI/res/layout/navigation_bar.xml
index 898389d5c0a0..c92ba450be37 100644
--- a/packages/SystemUI/res/layout/navigation_bar.xml
+++ b/packages/SystemUI/res/layout/navigation_bar.xml
@@ -4,16 +4,16 @@
**
** Copyright 2011, 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
+** 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
+** 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
+** 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.
*/
-->
@@ -57,7 +57,7 @@
android:scaleType="center"
android:contentDescription="@string/accessibility_back"
/>
- <View
+ <View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
@@ -73,7 +73,7 @@
android:scaleType="center"
android:contentDescription="@string/accessibility_home"
/>
- <View
+ <View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
@@ -130,8 +130,9 @@
android:src="@drawable/ic_sysbar_lights_out_dot_small"
android:scaleType="center"
android:layout_weight="0"
+ android:contentDescription="@string/accessibility_back"
/>
- <View
+ <View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
@@ -143,8 +144,9 @@
android:src="@drawable/ic_sysbar_lights_out_dot_large"
android:scaleType="center"
android:layout_weight="0"
+ android:contentDescription="@string/accessibility_home"
/>
- <View
+ <View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
@@ -157,6 +159,7 @@
android:src="@drawable/ic_sysbar_lights_out_dot_small"
android:scaleType="center"
android:layout_weight="0"
+ android:contentDescription="@string/accessibility_recent"
/>
</LinearLayout>
@@ -180,7 +183,7 @@
android:paddingTop="0dp"
>
- <LinearLayout
+ <LinearLayout
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical"
@@ -225,7 +228,7 @@
android:layout_weight="0"
android:contentDescription="@string/accessibility_recent"
/>
- <View
+ <View
android:layout_height="match_parent"
android:layout_width="match_parent"
android:layout_weight="1"
@@ -241,7 +244,7 @@
android:layout_weight="0"
android:contentDescription="@string/accessibility_home"
/>
- <View
+ <View
android:layout_height="match_parent"
android:layout_width="match_parent"
android:layout_weight="1"
@@ -265,7 +268,7 @@
</LinearLayout>
<!-- lights out layout to match exactly -->
- <LinearLayout
+ <LinearLayout
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical"
@@ -279,8 +282,9 @@
android:src="@drawable/ic_sysbar_lights_out_dot_small"
android:scaleType="center"
android:layout_weight="0"
+ android:contentDescription="@string/accessibility_recent"
/>
- <View
+ <View
android:layout_height="match_parent"
android:layout_width="match_parent"
android:layout_weight="1"
@@ -292,8 +296,9 @@
android:src="@drawable/ic_sysbar_lights_out_dot_large"
android:scaleType="center"
android:layout_weight="0"
+ android:contentDescription="@string/accessibility_home"
/>
- <View
+ <View
android:layout_height="match_parent"
android:layout_width="match_parent"
android:layout_weight="1"
@@ -306,6 +311,7 @@
android:src="@drawable/ic_sysbar_lights_out_dot_small"
android:scaleType="center"
android:layout_weight="0"
+ android:contentDescription="@string/accessibility_back"
/>
</LinearLayout>
diff --git a/packages/SystemUI/res/layout/volume_dialog_row.xml b/packages/SystemUI/res/layout/volume_dialog_row.xml
index d12bf5db3fb2..c6aa588ac5d6 100644
--- a/packages/SystemUI/res/layout/volume_dialog_row.xml
+++ b/packages/SystemUI/res/layout/volume_dialog_row.xml
@@ -22,15 +22,15 @@
<TextView
android:id="@+id/volume_row_header"
- style="?android:attr/textAppearanceButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
+ android:textAppearance="@style/TextAppearance.Volume.Header"
android:paddingBottom="0dp"
android:paddingEnd="12dp"
- android:paddingStart="13dp"
- android:paddingTop="8dp" />
+ android:paddingStart="12dp"
+ android:paddingTop="4dp" />
<com.android.keyguard.AlphaOptimizedImageButton
android:id="@+id/volume_row_icon"
diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml
index bda39b1a9900..67d3312b25b3 100644
--- a/packages/SystemUI/res/values/styles.xml
+++ b/packages/SystemUI/res/values/styles.xml
@@ -275,6 +275,11 @@
<item name="android:fontFamily">sans-serif</item>
</style>
+ <style name="TextAppearance.Volume.Header">
+ <item name="android:textSize">12sp</item>
+ <item name="android:textColor">@color/volume_slider_inactive</item>
+ </style>
+
<style name="TextAppearance.Volume.ZenSummary">
<item name="android:textSize">14sp</item>
<item name="android:fontFamily">sans-serif-medium</item>
diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java
index 29bea4d9faa2..49278c56b012 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java
@@ -524,6 +524,7 @@ public class VolumeDialog {
}
}
Util.setVisOrInvis(row.settingsButton, false);
+ updateVolumeRowHeaderVisibleH(row);
row.header.setAlpha(mExpanded && isActive ? 1 : 0.5f);
updateVolumeRowSliderTintH(row, isActive);
}
@@ -606,25 +607,22 @@ public class VolumeDialog {
}
// update header visible
- if (row.cachedShowHeaders != mShowHeaders) {
- row.cachedShowHeaders = mShowHeaders;
- Util.setVisOrGone(row.header, mShowHeaders);
- }
+ updateVolumeRowHeaderVisibleH(row);
// update header text
- final String text;
- if (isRingZenNone) {
- text = mContext.getString(R.string.volume_stream_muted_dnd, ss.name);
- } else if (isRingVibrate && isRingLimited) {
- text = mContext.getString(R.string.volume_stream_vibrate_dnd, ss.name);
- } else if (isRingVibrate) {
- text = mContext.getString(R.string.volume_stream_vibrate, ss.name);
- } else if (ss.muted || mAutomute && ss.level == 0) {
- text = mContext.getString(R.string.volume_stream_muted, ss.name);
- } else if (isRingLimited) {
- text = mContext.getString(R.string.volume_stream_limited_dnd, ss.name);
- } else {
- text = ss.name;
+ String text = ss.name;
+ if (mShowHeaders) {
+ if (isRingZenNone) {
+ text = mContext.getString(R.string.volume_stream_muted_dnd, ss.name);
+ } else if (isRingVibrate && isRingLimited) {
+ text = mContext.getString(R.string.volume_stream_vibrate_dnd, ss.name);
+ } else if (isRingVibrate) {
+ text = mContext.getString(R.string.volume_stream_vibrate, ss.name);
+ } else if (ss.muted || mAutomute && ss.level == 0) {
+ text = mContext.getString(R.string.volume_stream_muted, ss.name);
+ } else if (isRingLimited) {
+ text = mContext.getString(R.string.volume_stream_limited_dnd, ss.name);
+ }
}
Util.setText(row.header, text);
@@ -663,6 +661,15 @@ public class VolumeDialog {
updateVolumeRowSliderH(row, enableSlider, vlevel);
}
+ private void updateVolumeRowHeaderVisibleH(VolumeRow row) {
+ final boolean dynamic = row.ss != null && row.ss.dynamic;
+ final boolean showHeaders = mShowHeaders || mExpanded && dynamic;
+ if (row.cachedShowHeaders != showHeaders) {
+ row.cachedShowHeaders = showHeaders;
+ Util.setVisOrGone(row.header, showHeaders);
+ }
+ }
+
private void updateVolumeRowSliderTintH(VolumeRow row, boolean isActive) {
final ColorStateList tint = isActive && row.slider.isEnabled() ? mActiveSliderTint
: mInactiveSliderTint;
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java
index 2f68aa8cd55d..9c6e16f509ec 100644
--- a/services/core/java/com/android/server/ConnectivityService.java
+++ b/services/core/java/com/android/server/ConnectivityService.java
@@ -100,6 +100,7 @@ import android.util.Xml;
import com.android.internal.R;
import com.android.internal.annotations.GuardedBy;
+import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.app.IBatteryStats;
import com.android.internal.net.LegacyVpnInfo;
import com.android.internal.net.NetworkStatsFactory;
@@ -768,7 +769,8 @@ public class ConnectivityService extends IConnectivityManager.Stub
return mNextNetworkRequestId++;
}
- private int reserveNetId() {
+ @VisibleForTesting
+ protected int reserveNetId() {
synchronized (mNetworkForNetId) {
for (int i = MIN_NET_ID; i <= MAX_NET_ID; i++) {
int netId = mNextNetId;
@@ -1665,6 +1667,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
private static final String DEFAULT_TCP_RWND_KEY = "net.tcp.default_init_rwnd";
// Overridden for testing purposes to avoid writing to SystemProperties.
+ @VisibleForTesting
protected int getDefaultTcpRwnd() {
return SystemProperties.getInt(DEFAULT_TCP_RWND_KEY, 0);
}
diff --git a/services/tests/servicestests/src/com/android/server/ConnectivityServiceTest.java b/services/tests/servicestests/src/com/android/server/ConnectivityServiceTest.java
index 56f1d48c4b80..6684be473d2b 100644
--- a/services/tests/servicestests/src/com/android/server/ConnectivityServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/ConnectivityServiceTest.java
@@ -235,6 +235,27 @@ public class ConnectivityServiceTest extends AndroidTestCase {
// Prevent wrapped ConnectivityService from trying to write to SystemProperties.
return 0;
}
+
+ @Override
+ protected int reserveNetId() {
+ while (true) {
+ final int netId = super.reserveNetId();
+
+ // Don't overlap test NetIDs with real NetIDs as binding sockets to real networks
+ // can have odd side-effects, like network validations succeeding.
+ final Network[] networks = ConnectivityManager.from(getContext()).getAllNetworks();
+ boolean overlaps = false;
+ for (Network network : networks) {
+ if (netId == network.netId) {
+ overlaps = true;
+ break;
+ }
+ }
+ if (overlaps) continue;
+
+ return netId;
+ }
+ }
}
@Override