summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Android.mk8
-rw-r--r--api/current.txt14
-rw-r--r--api/system-current.txt14
-rw-r--r--core/java/android/app/ContextImpl.java4
-rw-r--r--core/java/android/content/Context.java2
-rw-r--r--core/java/android/widget/AbsSeekBar.java5
-rw-r--r--core/java/android/widget/ProgressBar.java58
-rw-r--r--core/res/res/color/white_disabled_material.xml20
-rw-r--r--core/res/res/drawable-hdpi/progress_mtrl_alpha.9.pngbin184 -> 0 bytes
-rw-r--r--core/res/res/drawable-mdpi/progress_mtrl_alpha.9.pngbin178 -> 0 bytes
-rw-r--r--core/res/res/drawable-xhdpi/progress_mtrl_alpha.9.pngbin185 -> 0 bytes
-rw-r--r--core/res/res/drawable-xxhdpi/progress_mtrl_alpha.9.pngbin177 -> 0 bytes
-rw-r--r--core/res/res/drawable/progress_horizontal_material.xml32
-rw-r--r--core/res/res/drawable/scrubber_progress_horizontal_material.xml40
-rw-r--r--core/res/res/drawable/switch_track_material.xml6
-rw-r--r--core/res/res/values/dimens_material.xml1
-rw-r--r--docs/html/tools/studio/index.jd9
-rw-r--r--graphics/java/android/graphics/drawable/LayerDrawable.java147
-rw-r--r--libs/hwui/GradientCache.cpp2
-rw-r--r--libs/hwui/RenderNode.cpp7
-rw-r--r--libs/hwui/Texture.cpp40
-rw-r--r--libs/hwui/Texture.h39
-rw-r--r--libs/hwui/TextureCache.cpp6
-rw-r--r--libs/hwui/tests/main.cpp2
-rw-r--r--media/java/android/media/midi/IMidiDeviceServer.aidl (renamed from core/java/android/midi/IMidiDeviceServer.aidl)2
-rw-r--r--media/java/android/media/midi/IMidiListener.aidl (renamed from core/java/android/midi/IMidiListener.aidl)4
-rw-r--r--media/java/android/media/midi/IMidiManager.aidl (renamed from core/java/android/midi/IMidiManager.aidl)8
-rw-r--r--media/java/android/media/midi/MidiDevice.java (renamed from core/java/android/midi/MidiDevice.java)2
-rw-r--r--media/java/android/media/midi/MidiDeviceInfo.aidl (renamed from core/java/android/midi/MidiDeviceInfo.aidl)2
-rw-r--r--media/java/android/media/midi/MidiDeviceInfo.java (renamed from core/java/android/midi/MidiDeviceInfo.java)2
-rw-r--r--media/java/android/media/midi/MidiDeviceServer.java (renamed from core/java/android/midi/MidiDeviceServer.java)2
-rw-r--r--media/java/android/media/midi/MidiInputPort.java (renamed from core/java/android/midi/MidiInputPort.java)2
-rw-r--r--media/java/android/media/midi/MidiManager.java (renamed from core/java/android/midi/MidiManager.java)44
-rw-r--r--media/java/android/media/midi/MidiOutputPort.java (renamed from core/java/android/midi/MidiOutputPort.java)2
-rw-r--r--media/java/android/media/midi/MidiPort.java (renamed from core/java/android/midi/MidiPort.java)31
-rw-r--r--media/java/android/media/midi/MidiReceiver.java (renamed from core/java/android/midi/MidiReceiver.java)4
-rw-r--r--media/java/android/media/midi/MidiSender.java (renamed from core/java/android/midi/MidiSender.java)2
-rw-r--r--services/core/java/com/android/server/MidiService.java8
-rw-r--r--services/core/java/com/android/server/am/ActivityStack.java7
-rw-r--r--services/usb/java/com/android/server/usb/UsbAlsaManager.java2
-rw-r--r--services/usb/java/com/android/server/usb/UsbDeviceManager.java1
-rw-r--r--services/usb/java/com/android/server/usb/UsbMidiDevice.java12
42 files changed, 407 insertions, 186 deletions
diff --git a/Android.mk b/Android.mk
index 44fdb777d37c..669efc782c0f 100644
--- a/Android.mk
+++ b/Android.mk
@@ -174,9 +174,6 @@ LOCAL_SRC_FILES += \
core/java/android/hardware/location/IGeofenceHardwareMonitorCallback.aidl \
core/java/android/hardware/soundtrigger/IRecognitionStatusCallback.aidl \
core/java/android/hardware/usb/IUsbManager.aidl \
- core/java/android/midi/IMidiDeviceServer.aidl \
- core/java/android/midi/IMidiListener.aidl \
- core/java/android/midi/IMidiManager.aidl \
core/java/android/net/IConnectivityManager.aidl \
core/java/android/net/IEthernetManager.aidl \
core/java/android/net/IEthernetServiceListener.aidl \
@@ -335,7 +332,10 @@ LOCAL_SRC_FILES += \
media/java/android/media/IRemoteVolumeObserver.aidl \
media/java/android/media/IRingtonePlayer.aidl \
media/java/android/media/IVolumeController.aidl \
- media/java/android/media/audiopolicy/IAudioPolicyCallback.aidl \
+ media/java/android/media/audiopolicy/IAudioPolicyCallback.aidl \
+ media/java/android/media/midi/IMidiDeviceServer.aidl \
+ media/java/android/media/midi/IMidiListener.aidl \
+ media/java/android/media/midi/IMidiManager.aidl \
media/java/android/media/projection/IMediaProjection.aidl \
media/java/android/media/projection/IMediaProjectionCallback.aidl \
media/java/android/media/projection/IMediaProjectionManager.aidl \
diff --git a/api/current.txt b/api/current.txt
index 46f41691fbe5..c7898e407a60 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -12018,6 +12018,12 @@ package android.graphics.drawable {
method public int getId(int);
method public int getLayerGravity(int);
method public int getLayerHeight(int);
+ method public int getLayerInsetBottom(int);
+ method public int getLayerInsetEnd(int);
+ method public int getLayerInsetLeft(int);
+ method public int getLayerInsetRight(int);
+ method public int getLayerInsetStart(int);
+ method public int getLayerInsetTop(int);
method public int getLayerWidth(int);
method public int getNumberOfLayers();
method public int getOpacity();
@@ -12030,9 +12036,17 @@ package android.graphics.drawable {
method public boolean setDrawableByLayerId(int, android.graphics.drawable.Drawable);
method public void setId(int, int);
method public void setLayerGravity(int, int);
+ method public void setLayerHeight(int, int);
method public void setLayerInset(int, int, int, int, int);
+ method public void setLayerInsetBottom(int, int);
+ method public void setLayerInsetEnd(int, int);
+ method public void setLayerInsetLeft(int, int);
method public void setLayerInsetRelative(int, int, int, int, int);
+ method public void setLayerInsetRight(int, int);
+ method public void setLayerInsetStart(int, int);
+ method public void setLayerInsetTop(int, int);
method public void setLayerSize(int, int, int);
+ method public void setLayerWidth(int, int);
method public void setOpacity(int);
method public void setPaddingMode(int);
method public void unscheduleDrawable(android.graphics.drawable.Drawable, java.lang.Runnable);
diff --git a/api/system-current.txt b/api/system-current.txt
index 58150cd8db74..f274a0dada14 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -12292,6 +12292,12 @@ package android.graphics.drawable {
method public int getId(int);
method public int getLayerGravity(int);
method public int getLayerHeight(int);
+ method public int getLayerInsetBottom(int);
+ method public int getLayerInsetEnd(int);
+ method public int getLayerInsetLeft(int);
+ method public int getLayerInsetRight(int);
+ method public int getLayerInsetStart(int);
+ method public int getLayerInsetTop(int);
method public int getLayerWidth(int);
method public int getNumberOfLayers();
method public int getOpacity();
@@ -12304,9 +12310,17 @@ package android.graphics.drawable {
method public boolean setDrawableByLayerId(int, android.graphics.drawable.Drawable);
method public void setId(int, int);
method public void setLayerGravity(int, int);
+ method public void setLayerHeight(int, int);
method public void setLayerInset(int, int, int, int, int);
+ method public void setLayerInsetBottom(int, int);
+ method public void setLayerInsetEnd(int, int);
+ method public void setLayerInsetLeft(int, int);
method public void setLayerInsetRelative(int, int, int, int, int);
+ method public void setLayerInsetRight(int, int);
+ method public void setLayerInsetStart(int, int);
+ method public void setLayerInsetTop(int, int);
method public void setLayerSize(int, int, int);
+ method public void setLayerWidth(int, int);
method public void setOpacity(int);
method public void setPaddingMode(int);
method public void unscheduleDrawable(android.graphics.drawable.Drawable, java.lang.Runnable);
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java
index db380edd20a4..503657bc9709 100644
--- a/core/java/android/app/ContextImpl.java
+++ b/core/java/android/app/ContextImpl.java
@@ -75,12 +75,12 @@ import android.location.ILocationManager;
import android.location.LocationManager;
import android.media.AudioManager;
import android.media.MediaRouter;
+import android.media.midi.IMidiManager;
+import android.media.midi.MidiManager;
import android.media.projection.MediaProjectionManager;
import android.media.session.MediaSessionManager;
import android.media.tv.ITvInputManager;
import android.media.tv.TvInputManager;
-import android.midi.IMidiManager;
-import android.midi.MidiManager;
import android.net.ConnectivityManager;
import android.net.IConnectivityManager;
import android.net.EthernetManager;
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index eabe297dd6ee..46ccc95874b2 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -2971,7 +2971,7 @@ public abstract class Context {
/**
* Use with {@link #getSystemService} to retrieve a
- * {@link android.midi.MidiManager} for accessing the MIDI service.
+ * {@link android.media.midi.MidiManager} for accessing the MIDI service.
*
* @see #getSystemService
* @hide
diff --git a/core/java/android/widget/AbsSeekBar.java b/core/java/android/widget/AbsSeekBar.java
index 78344ac675a4..79ad6e37c109 100644
--- a/core/java/android/widget/AbsSeekBar.java
+++ b/core/java/android/widget/AbsSeekBar.java
@@ -423,8 +423,8 @@ public abstract class AbsSeekBar extends ProgressBar {
}
if (track != null) {
- track.setBounds(0, trackOffset, w - mPaddingRight - mPaddingLeft,
- h - mPaddingBottom - trackOffset - mPaddingTop);
+ final int trackWidth = w - mPaddingRight - mPaddingLeft;
+ track.setBounds(0, trackOffset, trackWidth, trackOffset + trackHeight);
}
if (thumb != null) {
@@ -472,7 +472,6 @@ public abstract class AbsSeekBar extends ProgressBar {
final Drawable background = getBackground();
if (background != null) {
- final Rect bounds = thumb.getBounds();
final int offsetX = mPaddingLeft - mThumbOffset;
final int offsetY = mPaddingTop;
background.setHotspotBounds(left + offsetX, top + offsetY,
diff --git a/core/java/android/widget/ProgressBar.java b/core/java/android/widget/ProgressBar.java
index 406a274ce2a0..03878fc40c3e 100644
--- a/core/java/android/widget/ProgressBar.java
+++ b/core/java/android/widget/ProgressBar.java
@@ -401,36 +401,49 @@ public class ProgressBar extends View {
* traverse layer and state list drawables.
*/
private Drawable tileify(Drawable drawable, boolean clip) {
+ // TODO: This is a terrible idea that potentially destroys any drawable
+ // that extends any of these classes. We *really* need to remove this.
if (drawable instanceof LayerDrawable) {
- LayerDrawable background = (LayerDrawable) drawable;
- final int N = background.getNumberOfLayers();
- Drawable[] outDrawables = new Drawable[N];
+ final LayerDrawable orig = (LayerDrawable) drawable;
+ final int N = orig.getNumberOfLayers();
+ final Drawable[] outDrawables = new Drawable[N];
for (int i = 0; i < N; i++) {
- int id = background.getId(i);
- outDrawables[i] = tileify(background.getDrawable(i),
+ final int id = orig.getId(i);
+ outDrawables[i] = tileify(orig.getDrawable(i),
(id == R.id.progress || id == R.id.secondaryProgress));
}
- LayerDrawable newBg = new LayerDrawable(outDrawables);
-
+ final LayerDrawable clone = new LayerDrawable(outDrawables);
for (int i = 0; i < N; i++) {
- newBg.setId(i, background.getId(i));
+ clone.setId(i, orig.getId(i));
+ clone.setLayerGravity(i, orig.getLayerGravity(i));
+ clone.setLayerWidth(i, orig.getLayerWidth(i));
+ clone.setLayerHeight(i, orig.getLayerHeight(i));
+ clone.setLayerInsetLeft(i, orig.getLayerInsetLeft(i));
+ clone.setLayerInsetRight(i, orig.getLayerInsetRight(i));
+ clone.setLayerInsetTop(i, orig.getLayerInsetTop(i));
+ clone.setLayerInsetBottom(i, orig.getLayerInsetBottom(i));
+ clone.setLayerInsetStart(i, orig.getLayerInsetStart(i));
+ clone.setLayerInsetEnd(i, orig.getLayerInsetEnd(i));
}
- return newBg;
+ return clone;
+ }
- } else if (drawable instanceof StateListDrawable) {
- StateListDrawable in = (StateListDrawable) drawable;
- StateListDrawable out = new StateListDrawable();
- int numStates = in.getStateCount();
- for (int i = 0; i < numStates; i++) {
+ if (drawable instanceof StateListDrawable) {
+ final StateListDrawable in = (StateListDrawable) drawable;
+ final StateListDrawable out = new StateListDrawable();
+ final int N = in.getStateCount();
+ for (int i = 0; i < N; i++) {
out.addState(in.getStateSet(i), tileify(in.getStateDrawable(i), clip));
}
+
return out;
+ }
- } else if (drawable instanceof BitmapDrawable) {
+ if (drawable instanceof BitmapDrawable) {
final BitmapDrawable bitmap = (BitmapDrawable) drawable;
final Bitmap tileBitmap = bitmap.getBitmap();
if (mSampleTile == null) {
@@ -1648,7 +1661,7 @@ public class ProgressBar extends View {
// rotates properly in its animation
final int saveCount = canvas.save();
- if(isLayoutRtl() && mMirrorForRtl) {
+ if (isLayoutRtl() && mMirrorForRtl) {
canvas.translate(getWidth() - mPaddingRight, mPaddingTop);
canvas.scale(-1.0f, 1.0f);
} else {
@@ -1680,20 +1693,23 @@ public class ProgressBar extends View {
@Override
protected synchronized void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
- Drawable d = mCurrentDrawable;
-
int dw = 0;
int dh = 0;
+
+ final Drawable d = mCurrentDrawable;
if (d != null) {
dw = Math.max(mMinWidth, Math.min(mMaxWidth, d.getIntrinsicWidth()));
dh = Math.max(mMinHeight, Math.min(mMaxHeight, d.getIntrinsicHeight()));
}
+
updateDrawableState();
+
dw += mPaddingLeft + mPaddingRight;
dh += mPaddingTop + mPaddingBottom;
- setMeasuredDimension(resolveSizeAndState(dw, widthMeasureSpec, 0),
- resolveSizeAndState(dh, heightMeasureSpec, 0));
+ final int measuredWidth = resolveSizeAndState(dw, widthMeasureSpec, 0);
+ final int measuredHeight = resolveSizeAndState(dh, heightMeasureSpec, 0);
+ setMeasuredDimension(measuredWidth, measuredHeight);
}
@Override
@@ -1703,7 +1719,7 @@ public class ProgressBar extends View {
}
private void updateDrawableState() {
- int[] state = getDrawableState();
+ final int[] state = getDrawableState();
if (mProgressDrawable != null && mProgressDrawable.isStateful()) {
mProgressDrawable.setState(state);
diff --git a/core/res/res/color/white_disabled_material.xml b/core/res/res/color/white_disabled_material.xml
new file mode 100644
index 000000000000..c61f900ebaed
--- /dev/null
+++ b/core/res/res/color/white_disabled_material.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2015 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.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:color="@color/white"
+ android:alpha="?attr/disabledAlpha" />
+</selector>
diff --git a/core/res/res/drawable-hdpi/progress_mtrl_alpha.9.png b/core/res/res/drawable-hdpi/progress_mtrl_alpha.9.png
deleted file mode 100644
index fbb2e0c56096..000000000000
--- a/core/res/res/drawable-hdpi/progress_mtrl_alpha.9.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/progress_mtrl_alpha.9.png b/core/res/res/drawable-mdpi/progress_mtrl_alpha.9.png
deleted file mode 100644
index 92d4b05e57cb..000000000000
--- a/core/res/res/drawable-mdpi/progress_mtrl_alpha.9.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/progress_mtrl_alpha.9.png b/core/res/res/drawable-xhdpi/progress_mtrl_alpha.9.png
deleted file mode 100644
index e3c4eeb185e1..000000000000
--- a/core/res/res/drawable-xhdpi/progress_mtrl_alpha.9.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-xxhdpi/progress_mtrl_alpha.9.png b/core/res/res/drawable-xxhdpi/progress_mtrl_alpha.9.png
deleted file mode 100644
index 452f45ce362c..000000000000
--- a/core/res/res/drawable-xxhdpi/progress_mtrl_alpha.9.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable/progress_horizontal_material.xml b/core/res/res/drawable/progress_horizontal_material.xml
index 6b64337fcf59..c1795640fe5f 100644
--- a/core/res/res/drawable/progress_horizontal_material.xml
+++ b/core/res/res/drawable/progress_horizontal_material.xml
@@ -15,22 +15,32 @@
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:id="@id/background">
- <nine-patch android:src="@drawable/progress_mtrl_alpha"
- android:tint="?attr/colorControlNormal"
- android:alpha="?attr/disabledAlpha" />
+ <item android:id="@id/background"
+ android:gravity="center_vertical|fill_horizontal">
+ <shape android:shape="rectangle"
+ android:tint="?attr/colorControlNormal">
+ <size android:height="@dimen/progress_bar_height_material" />
+ <solid android:color="@color/white_disabled_material" />
+ </shape>
</item>
- <item android:id="@id/secondaryProgress">
+ <item android:id="@id/secondaryProgress"
+ android:gravity="center_vertical|fill_horizontal">
<scale android:scaleWidth="100%">
- <nine-patch android:src="@drawable/progress_mtrl_alpha"
- android:tint="?attr/colorControlActivated"
- android:alpha="?attr/disabledAlpha" />
+ <shape android:shape="rectangle"
+ android:tint="?attr/colorControlActivated">
+ <size android:height="@dimen/progress_bar_height_material" />
+ <solid android:color="@color/white_disabled_material" />
+ </shape>
</scale>
</item>
- <item android:id="@id/progress">
+ <item android:id="@id/progress"
+ android:gravity="center_vertical|fill_horizontal">
<scale android:scaleWidth="100%">
- <nine-patch android:src="@drawable/progress_mtrl_alpha"
- android:tint="?attr/colorControlActivated" />
+ <shape android:shape="rectangle"
+ android:tint="?attr/colorControlActivated">
+ <size android:height="@dimen/progress_bar_height_material" />
+ <solid android:color="@color/white" />
+ </shape>
</scale>
</item>
</layer-list>
diff --git a/core/res/res/drawable/scrubber_progress_horizontal_material.xml b/core/res/res/drawable/scrubber_progress_horizontal_material.xml
index 89a1787df677..86a85c3da695 100644
--- a/core/res/res/drawable/scrubber_progress_horizontal_material.xml
+++ b/core/res/res/drawable/scrubber_progress_horizontal_material.xml
@@ -15,32 +15,42 @@
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:id="@id/background">
- <nine-patch android:src="@drawable/scrubber_track_mtrl_alpha"
- android:tint="?attr/colorControlNormal" />
+ <item android:id="@id/background"
+ android:gravity="center_vertical|fill_horizontal">
+ <shape android:shape="rectangle"
+ android:tint="?attr/colorControlNormal">
+ <size android:height="@dimen/scrubber_track_height_material" />
+ <solid android:color="@color/white_disabled_material" />
+ </shape>
</item>
- <item android:id="@id/secondaryProgress">
+ <item android:id="@id/secondaryProgress"
+ android:gravity="center_vertical|fill_horizontal">
<scale android:scaleWidth="100%">
<selector>
- <item android:state_enabled="false">
- <color android:color="@color/transparent" />
- </item>
+ <item android:state_enabled="false"
+ android:drawable="@color/transparent" />
<item>
- <nine-patch android:src="@drawable/scrubber_primary_mtrl_alpha"
- android:tint="?attr/colorControlNormal" />
+ <shape android:shape="rectangle"
+ android:tint="?attr/colorControlActivated">
+ <size android:height="@dimen/scrubber_track_height_material" />
+ <solid android:color="@color/white_disabled_material" />
+ </shape>
</item>
</selector>
</scale>
</item>
- <item android:id="@id/progress">
+ <item android:id="@id/progress"
+ android:gravity="center_vertical|fill_horizontal">
<scale android:scaleWidth="100%">
<selector>
- <item android:state_enabled="false">
- <color android:color="@color/transparent" />
- </item>
+ <item android:state_enabled="false"
+ android:drawable="@color/transparent" />
<item>
- <nine-patch android:src="@drawable/scrubber_primary_mtrl_alpha"
- android:tint="?attr/colorControlActivated" />
+ <shape android:shape="rectangle"
+ android:tint="?attr/colorControlActivated">
+ <size android:height="@dimen/progress_bar_height_material" />
+ <solid android:color="@color/white" />
+ </shape>
</item>
</selector>
</scale>
diff --git a/core/res/res/drawable/switch_track_material.xml b/core/res/res/drawable/switch_track_material.xml
index a825fe444918..8b028d3bb825 100644
--- a/core/res/res/drawable/switch_track_material.xml
+++ b/core/res/res/drawable/switch_track_material.xml
@@ -16,12 +16,12 @@
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:gravity="center_vertical|fill_horizontal"
- android:start="2dp"
- android:end="2dp">
+ android:start="4dp"
+ android:end="4dp">
<shape android:shape="rectangle"
android:tint="@color/switch_track_material">
<corners android:radius="7dp" />
- <solid android:color="#4dffffff" />
+ <solid android:color="@color/white_disabled_material" />
<size android:height="14dp" />
</shape>
</item>
diff --git a/core/res/res/values/dimens_material.xml b/core/res/res/values/dimens_material.xml
index 0e2c4800ebc3..b84249a9fe4e 100644
--- a/core/res/res/values/dimens_material.xml
+++ b/core/res/res/values/dimens_material.xml
@@ -115,5 +115,6 @@
<!-- Padding above and below selection dialog lists. -->
<dimen name="dialog_list_padding_vertical_material">8dp</dimen>
+ <dimen name="scrubber_track_height_material">2dp</dimen>
<dimen name="progress_bar_height_material">4dp</dimen>
</resources>
diff --git a/docs/html/tools/studio/index.jd b/docs/html/tools/studio/index.jd
index 9e7721bd739f..1860feb97151 100644
--- a/docs/html/tools/studio/index.jd
+++ b/docs/html/tools/studio/index.jd
@@ -96,10 +96,9 @@ top level of the project hierarchy and contains these three elements at the top
<p>For example, <em>Android</em> project view groups all the instances of the
<code>ic_launcher.png</code> resource for different screen densities under the same element.</p>
-<p class="note"><strong>Note:</strong> The project structure on disk differs from this flattened
-representation. To switch to back the segregated project view, select <strong>Project</strong> from
-the <strong>Project</strong drop-down. </p>
-
+<p class="note"><strong>Note:</strong> The project structure on disk differs from this flattened
+representation. To switch to back to the segregated project view, select <strong>Project</strong> from
+the <strong>Project</strong> drop-down. </p>
<h3>Android Studio Project and Directory Structure</h3>
@@ -182,7 +181,7 @@ uniquely identify application packages for publishing. The application ID is set
<p class="note"><strong>Note:</strong> The <em>applicationId</em> is specified only in your
build.gradle file, and not in the AndroidManifest.xml file.</p>
-<p>When using build variants, the build system enables you to to uniquely identify different
+<p>When using build variants, the build system enables you to uniquely identify different
packages for each product flavors and build types. The application ID in the build type is added as
a suffix to those specified for the product flavors. </p>
diff --git a/graphics/java/android/graphics/drawable/LayerDrawable.java b/graphics/java/android/graphics/drawable/LayerDrawable.java
index 08849dffd0ad..f5353d461b6d 100644
--- a/graphics/java/android/graphics/drawable/LayerDrawable.java
+++ b/graphics/java/android/graphics/drawable/LayerDrawable.java
@@ -558,10 +558,9 @@ public class LayerDrawable extends Drawable implements Drawable.Callback {
* default layer gravity behavior. See {@link #setLayerGravity(int, int)}
* for more information.
*
- * @param index the index of the drawable to adjust
+ * @param index the index of the layer to adjust
* @param w width in pixels, or -1 to use the intrinsic width
* @param h height in pixels, or -1 to use the intrinsic height
- *
* @see #getLayerWidth(int)
* @see #getLayerHeight(int)
* @attr ref android.R.styleable#LayerDrawableItem_width
@@ -574,9 +573,18 @@ public class LayerDrawable extends Drawable implements Drawable.Callback {
}
/**
+ * @param index the index of the layer to adjust
+ * @param w width in pixels, or -1 to use the intrinsic width
+ * @attr ref android.R.styleable#LayerDrawableItem_width
+ */
+ public void setLayerWidth(int index, int w) {
+ final ChildDrawable childDrawable = mLayerState.mChildren[index];
+ childDrawable.mWidth = w;
+ }
+
+ /**
* @param index the index of the drawable to adjust
* @return the explicit width of the layer, or -1 if not specified
- *
* @see #setLayerSize(int, int, int)
* @attr ref android.R.styleable#LayerDrawableItem_width
*/
@@ -586,9 +594,18 @@ public class LayerDrawable extends Drawable implements Drawable.Callback {
}
/**
+ * @param index the index of the layer to adjust
+ * @param h height in pixels, or -1 to use the intrinsic height
+ * @attr ref android.R.styleable#LayerDrawableItem_height
+ */
+ public void setLayerHeight(int index, int h) {
+ final ChildDrawable childDrawable = mLayerState.mChildren[index];
+ childDrawable.mHeight = h;
+ }
+
+ /**
* @param index the index of the drawable to adjust
* @return the explicit height of the layer, or -1 if not specified
- *
* @see #setLayerSize(int, int, int)
* @attr ref android.R.styleable#LayerDrawableItem_height
*/
@@ -656,7 +673,7 @@ public class LayerDrawable extends Drawable implements Drawable.Callback {
* Specifies the relative insets in pixels for the drawable at the
* specified index.
*
- * @param index the index of the drawable to adjust
+ * @param index the index of the layer to adjust
* @param s number of pixels to inset from the start bound
* @param t number of pixels to inset from the top bound
* @param e number of pixels to inset from the end bound
@@ -671,6 +688,126 @@ public class LayerDrawable extends Drawable implements Drawable.Callback {
setLayerInsetInternal(index, 0, t, 0, b, s, e);
}
+ /**
+ * @param index the index of the layer to adjust
+ * @param l number of pixels to inset from the left bound
+ * @attr ref android.R.styleable#LayerDrawableItem_left
+ */
+ public void setLayerInsetLeft(int index, int l) {
+ final ChildDrawable childDrawable = mLayerState.mChildren[index];
+ childDrawable.mInsetL = l;
+ }
+
+ /**
+ * @param index the index of the layer
+ * @return number of pixels to inset from the left bound
+ * @attr ref android.R.styleable#LayerDrawableItem_left
+ */
+ public int getLayerInsetLeft(int index) {
+ final ChildDrawable childDrawable = mLayerState.mChildren[index];
+ return childDrawable.mInsetL;
+ }
+
+ /**
+ * @param index the index of the layer to adjust
+ * @param r number of pixels to inset from the right bound
+ * @attr ref android.R.styleable#LayerDrawableItem_right
+ */
+ public void setLayerInsetRight(int index, int r) {
+ final ChildDrawable childDrawable = mLayerState.mChildren[index];
+ childDrawable.mInsetR = r;
+ }
+
+ /**
+ * @param index the index of the layer
+ * @return number of pixels to inset from the right bound
+ * @attr ref android.R.styleable#LayerDrawableItem_right
+ */
+ public int getLayerInsetRight(int index) {
+ final ChildDrawable childDrawable = mLayerState.mChildren[index];
+ return childDrawable.mInsetR;
+ }
+
+ /**
+ * @param index the index of the layer to adjust
+ * @param t number of pixels to inset from the top bound
+ * @attr ref android.R.styleable#LayerDrawableItem_top
+ */
+ public void setLayerInsetTop(int index, int t) {
+ final ChildDrawable childDrawable = mLayerState.mChildren[index];
+ childDrawable.mInsetT = t;
+ }
+
+ /**
+ * @param index the index of the layer
+ * @return number of pixels to inset from the top bound
+ * @attr ref android.R.styleable#LayerDrawableItem_top
+ */
+ public int getLayerInsetTop(int index) {
+ final ChildDrawable childDrawable = mLayerState.mChildren[index];
+ return childDrawable.mInsetT;
+ }
+
+ /**
+ * @param index the index of the layer to adjust
+ * @param b number of pixels to inset from the bottom bound
+ * @attr ref android.R.styleable#LayerDrawableItem_bottom
+ */
+ public void setLayerInsetBottom(int index, int b) {
+ final ChildDrawable childDrawable = mLayerState.mChildren[index];
+ childDrawable.mInsetB = b;
+ }
+
+ /**
+ * @param index the index of the layer
+ * @return number of pixels to inset from the bottom bound
+ * @attr ref android.R.styleable#LayerDrawableItem_bottom
+ */
+ public int getLayerInsetBottom(int index) {
+ final ChildDrawable childDrawable = mLayerState.mChildren[index];
+ return childDrawable.mInsetB;
+ }
+
+ /**
+ * @param index the index of the layer to adjust
+ * @param s number of pixels to inset from the start bound
+ * @attr ref android.R.styleable#LayerDrawableItem_start
+ */
+ public void setLayerInsetStart(int index, int s) {
+ final ChildDrawable childDrawable = mLayerState.mChildren[index];
+ childDrawable.mInsetS = s;
+ }
+
+ /**
+ * @param index the index of the layer
+ * @return number of pixels to inset from the start bound
+ * @attr ref android.R.styleable#LayerDrawableItem_start
+ */
+ public int getLayerInsetStart(int index) {
+ final ChildDrawable childDrawable = mLayerState.mChildren[index];
+ return childDrawable.mInsetS;
+ }
+
+ /**
+ * @param index the index of the layer to adjust
+ * @param e number of pixels to inset from the end bound
+ * @attr ref android.R.styleable#LayerDrawableItem_end
+ */
+ public void setLayerInsetEnd(int index, int e) {
+ final ChildDrawable childDrawable = mLayerState.mChildren[index];
+ childDrawable.mInsetE = e;
+ }
+
+ /**
+ * @param index the index of the layer
+ * @return number of pixels to inset from the end bound
+ * @attr ref android.R.styleable#LayerDrawableItem_end
+ */
+ public int getLayerInsetEnd(int index) {
+ final ChildDrawable childDrawable = mLayerState.mChildren[index];
+ return childDrawable.mInsetE;
+ }
+
private void setLayerInsetInternal(int index, int l, int t, int r, int b, int s, int e) {
final ChildDrawable childDrawable = mLayerState.mChildren[index];
childDrawable.mInsetL = l;
diff --git a/libs/hwui/GradientCache.cpp b/libs/hwui/GradientCache.cpp
index fb4c7854df14..ea93e7f9716b 100644
--- a/libs/hwui/GradientCache.cpp
+++ b/libs/hwui/GradientCache.cpp
@@ -166,7 +166,7 @@ Texture* GradientCache::addLinearGradient(GradientCacheEntry& gradient,
GradientInfo info;
getGradientInfo(colors, count, info);
- Texture* texture = new Texture();
+ Texture* texture = new Texture(Caches::getInstance());
texture->width = info.width;
texture->height = 2;
texture->blend = info.hasAlpha;
diff --git a/libs/hwui/RenderNode.cpp b/libs/hwui/RenderNode.cpp
index 659ef6c1600e..c6fdd3f47cb8 100644
--- a/libs/hwui/RenderNode.cpp
+++ b/libs/hwui/RenderNode.cpp
@@ -402,9 +402,10 @@ void RenderNode::setViewProperties(OpenGLRenderer& renderer, T& handler) {
clipFlags = 0; // all clipping done by saveLayer
}
- ATRACE_FORMAT("%s alpha caused %ssaveLayer %dx%d",
- getName(), clipFlags ? "" : "unclipped ",
- (int)layerBounds.getWidth(), (int)layerBounds.getHeight());
+ ATRACE_FORMAT("%s alpha caused %ssaveLayer %dx%d", getName(),
+ (saveFlags & SkCanvas::kClipToLayer_SaveFlag) ? "" : "unclipped ",
+ static_cast<int>(layerBounds.getWidth()),
+ static_cast<int>(layerBounds.getHeight()));
SaveLayerOp* op = new (handler.allocator()) SaveLayerOp(
layerBounds.left, layerBounds.top, layerBounds.right, layerBounds.bottom,
diff --git a/libs/hwui/Texture.cpp b/libs/hwui/Texture.cpp
index 512f5cf0d9a3..593e91818093 100644
--- a/libs/hwui/Texture.cpp
+++ b/libs/hwui/Texture.cpp
@@ -24,46 +24,6 @@
namespace android {
namespace uirenderer {
-Texture::Texture()
- : id(0)
- , generation(0)
- , blend(false)
- , width(0)
- , height(0)
- , cleanup(false)
- , bitmapSize(0)
- , mipMap(false)
- , uvMapper(nullptr)
- , isInUse(false)
- , mWrapS(GL_CLAMP_TO_EDGE)
- , mWrapT(GL_CLAMP_TO_EDGE)
- , mMinFilter(GL_NEAREST)
- , mMagFilter(GL_NEAREST)
- , mFirstFilter(true)
- , mFirstWrap(true)
- , mCaches(Caches::getInstance()) {
-}
-
-Texture::Texture(Caches& caches)
- : id(0)
- , generation(0)
- , blend(false)
- , width(0)
- , height(0)
- , cleanup(false)
- , bitmapSize(0)
- , mipMap(false)
- , uvMapper(nullptr)
- , isInUse(false)
- , mWrapS(GL_CLAMP_TO_EDGE)
- , mWrapT(GL_CLAMP_TO_EDGE)
- , mMinFilter(GL_NEAREST)
- , mMagFilter(GL_NEAREST)
- , mFirstFilter(true)
- , mFirstWrap(true)
- , mCaches(caches) {
-}
-
void Texture::setWrapST(GLenum wrapS, GLenum wrapT, bool bindTexture, bool force,
GLenum renderTarget) {
diff --git a/libs/hwui/Texture.h b/libs/hwui/Texture.h
index d5601f801fcd..dfec46286579 100644
--- a/libs/hwui/Texture.h
+++ b/libs/hwui/Texture.h
@@ -30,8 +30,7 @@ class UvMapper;
*/
class Texture {
public:
- Texture();
- Texture(Caches& caches);
+ Texture(Caches& caches) : mCaches(caches) { }
virtual ~Texture() { }
@@ -59,62 +58,62 @@ public:
/**
* Name of the texture.
*/
- GLuint id;
+ GLuint id = 0;
/**
* Generation of the backing bitmap,
*/
- uint32_t generation;
+ uint32_t generation = 0;
/**
* Indicates whether the texture requires blending.
*/
- bool blend;
+ bool blend = false;
/**
* Width of the backing bitmap.
*/
- uint32_t width;
+ uint32_t width = 0;
/**
* Height of the backing bitmap.
*/
- uint32_t height;
+ uint32_t height = 0;
/**
* Indicates whether this texture should be cleaned up after use.
*/
- bool cleanup;
+ bool cleanup= false;
/**
* Optional, size of the original bitmap.
*/
- uint32_t bitmapSize;
+ uint32_t bitmapSize = 0;
/**
* Indicates whether this texture will use trilinear filtering.
*/
- bool mipMap;
+ bool mipMap = false;
/**
* Optional, pointer to a texture coordinates mapper.
*/
- const UvMapper* uvMapper;
+ const UvMapper* uvMapper = nullptr;
/**
* Whether or not the Texture is marked in use and thus not evictable for
* the current frame. This is reset at the start of a new frame.
*/
- bool isInUse;
+ bool isInUse = false;
private:
/**
- * Last wrap modes set on this texture. Defaults to GL_CLAMP_TO_EDGE.
+ * Last wrap modes set on this texture.
*/
- GLenum mWrapS;
- GLenum mWrapT;
+ GLenum mWrapS = GL_CLAMP_TO_EDGE;
+ GLenum mWrapT = GL_CLAMP_TO_EDGE;
/**
- * Last filters set on this texture. Defaults to GL_NEAREST.
+ * Last filters set on this texture.
*/
- GLenum mMinFilter;
- GLenum mMagFilter;
+ GLenum mMinFilter = GL_NEAREST;
+ GLenum mMagFilter = GL_NEAREST;
- bool mFirstFilter;
- bool mFirstWrap;
+ bool mFirstFilter = true;
+ bool mFirstWrap = true;
Caches& mCaches;
}; // struct Texture
diff --git a/libs/hwui/TextureCache.cpp b/libs/hwui/TextureCache.cpp
index f4f8e44e5039..b911a0f3d4c7 100644
--- a/libs/hwui/TextureCache.cpp
+++ b/libs/hwui/TextureCache.cpp
@@ -168,7 +168,7 @@ Texture* TextureCache::getCachedTexture(const SkBitmap* bitmap) {
}
if (canCache) {
- texture = new Texture();
+ texture = new Texture(Caches::getInstance());
texture->bitmapSize = size;
generateTexture(bitmap, texture, false);
@@ -206,7 +206,7 @@ Texture* TextureCache::get(const SkBitmap* bitmap) {
}
const uint32_t size = bitmap->rowBytes() * bitmap->height();
- texture = new Texture();
+ texture = new Texture(Caches::getInstance());
texture->bitmapSize = size;
generateTexture(bitmap, texture, false);
texture->cleanup = true;
@@ -216,7 +216,7 @@ Texture* TextureCache::get(const SkBitmap* bitmap) {
}
Texture* TextureCache::getTransient(const SkBitmap* bitmap) {
- Texture* texture = new Texture();
+ Texture* texture = new Texture(Caches::getInstance());
texture->bitmapSize = bitmap->rowBytes() * bitmap->height();
texture->cleanup = true;
diff --git a/libs/hwui/tests/main.cpp b/libs/hwui/tests/main.cpp
index 0431e228050e..b61d72fa56dd 100644
--- a/libs/hwui/tests/main.cpp
+++ b/libs/hwui/tests/main.cpp
@@ -89,8 +89,6 @@ public:
android::uirenderer::Rect DUMMY;
- std::vector< sp<RenderNode> > cards;
-
DisplayListRenderer* renderer = startRecording(rootNode);
animation.createContent(width, height, renderer);
endRecording(renderer, rootNode);
diff --git a/core/java/android/midi/IMidiDeviceServer.aidl b/media/java/android/media/midi/IMidiDeviceServer.aidl
index 31fdbbb94f04..71914ad5892d 100644
--- a/core/java/android/midi/IMidiDeviceServer.aidl
+++ b/media/java/android/media/midi/IMidiDeviceServer.aidl
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.midi;
+package android.media.midi;
import android.os.ParcelFileDescriptor;
diff --git a/core/java/android/midi/IMidiListener.aidl b/media/java/android/media/midi/IMidiListener.aidl
index b6505939f2a5..a4129e992761 100644
--- a/core/java/android/midi/IMidiListener.aidl
+++ b/media/java/android/media/midi/IMidiListener.aidl
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package android.midi;
+package android.media.midi;
-import android.midi.MidiDeviceInfo;
+import android.media.midi.MidiDeviceInfo;
/** @hide */
oneway interface IMidiListener
diff --git a/core/java/android/midi/IMidiManager.aidl b/media/java/android/media/midi/IMidiManager.aidl
index 575b525bd146..bba35f52237c 100644
--- a/core/java/android/midi/IMidiManager.aidl
+++ b/media/java/android/media/midi/IMidiManager.aidl
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-package android.midi;
+package android.media.midi;
-import android.midi.IMidiDeviceServer;
-import android.midi.IMidiListener;
-import android.midi.MidiDeviceInfo;
+import android.media.midi.IMidiDeviceServer;
+import android.media.midi.IMidiListener;
+import android.media.midi.MidiDeviceInfo;
import android.os.Bundle;
import android.os.IBinder;
diff --git a/core/java/android/midi/MidiDevice.java b/media/java/android/media/midi/MidiDevice.java
index b91aedf4f6b1..36710fd6fbbe 100644
--- a/core/java/android/midi/MidiDevice.java
+++ b/media/java/android/media/midi/MidiDevice.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.midi;
+package android.media.midi;
import android.os.ParcelFileDescriptor;
import android.os.RemoteException;
diff --git a/core/java/android/midi/MidiDeviceInfo.aidl b/media/java/android/media/midi/MidiDeviceInfo.aidl
index 59be0593e3ba..f2f37a22cc91 100644
--- a/core/java/android/midi/MidiDeviceInfo.aidl
+++ b/media/java/android/media/midi/MidiDeviceInfo.aidl
@@ -14,6 +14,6 @@
* limitations under the License.
*/
-package android.midi;
+package android.media.midi;
parcelable MidiDeviceInfo;
diff --git a/core/java/android/midi/MidiDeviceInfo.java b/media/java/android/media/midi/MidiDeviceInfo.java
index dde266972b65..fd35052c367e 100644
--- a/core/java/android/midi/MidiDeviceInfo.java
+++ b/media/java/android/media/midi/MidiDeviceInfo.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.midi;
+package android.media.midi;
import android.os.Bundle;
import android.os.Parcel;
diff --git a/core/java/android/midi/MidiDeviceServer.java b/media/java/android/media/midi/MidiDeviceServer.java
index 4a1995f8a126..3317baa491f4 100644
--- a/core/java/android/midi/MidiDeviceServer.java
+++ b/media/java/android/media/midi/MidiDeviceServer.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.midi;
+package android.media.midi;
import android.os.ParcelFileDescriptor;
import android.os.RemoteException;
diff --git a/core/java/android/midi/MidiInputPort.java b/media/java/android/media/midi/MidiInputPort.java
index 735c68affd99..730d36442336 100644
--- a/core/java/android/midi/MidiInputPort.java
+++ b/media/java/android/media/midi/MidiInputPort.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.midi;
+package android.media.midi;
import android.os.ParcelFileDescriptor;
diff --git a/core/java/android/midi/MidiManager.java b/media/java/android/media/midi/MidiManager.java
index 3a0b064f7e5c..410120dbb8f8 100644
--- a/core/java/android/midi/MidiManager.java
+++ b/media/java/android/media/midi/MidiManager.java
@@ -14,12 +14,13 @@
* limitations under the License.
*/
-package android.midi;
+package android.media.midi;
import android.content.Context;
import android.os.Binder;
import android.os.IBinder;
import android.os.Bundle;
+import android.os.Handler;
import android.os.RemoteException;
import android.util.Log;
@@ -50,18 +51,38 @@ public class MidiManager {
// Binder stub for receiving device notifications from MidiService
private class DeviceListener extends IMidiListener.Stub {
- private DeviceCallback mCallback;
+ private final DeviceCallback mCallback;
+ private final Handler mHandler;
- public DeviceListener(DeviceCallback callback) {
+ public DeviceListener(DeviceCallback callback, Handler handler) {
mCallback = callback;
+ mHandler = handler;
}
public void onDeviceAdded(MidiDeviceInfo device) {
- mCallback.onDeviceAdded(device);
+ if (mHandler != null) {
+ final MidiDeviceInfo deviceF = device;
+ mHandler.post(new Runnable() {
+ @Override public void run() {
+ mCallback.onDeviceAdded(deviceF);
+ }
+ });
+ } else {
+ mCallback.onDeviceAdded(device);
+ }
}
public void onDeviceRemoved(MidiDeviceInfo device) {
- mCallback.onDeviceRemoved(device);
+ if (mHandler != null) {
+ final MidiDeviceInfo deviceF = device;
+ mHandler.post(new Runnable() {
+ @Override public void run() {
+ mCallback.onDeviceRemoved(deviceF);
+ }
+ });
+ } else {
+ mCallback.onDeviceRemoved(device);
+ }
}
}
@@ -74,7 +95,7 @@ public class MidiManager {
*
* @param device a {@link MidiDeviceInfo} for the newly added device
*/
- void onDeviceAdded(MidiDeviceInfo device) {
+ public void onDeviceAdded(MidiDeviceInfo device) {
}
/**
@@ -82,7 +103,7 @@ public class MidiManager {
*
* @param device a {@link MidiDeviceInfo} for the removed device
*/
- void onDeviceRemoved(MidiDeviceInfo device) {
+ public void onDeviceRemoved(MidiDeviceInfo device) {
}
}
@@ -98,9 +119,12 @@ public class MidiManager {
* Registers a callback to receive notifications when MIDI devices are added and removed.
*
* @param callback a {@link DeviceCallback} for MIDI device notifications
+ * @param handler The {@link android.os.Handler Handler} that will be used for delivering the
+ * device notifications. If handler is null, then the thread used for the
+ * callback is unspecified.
*/
- public void registerDeviceCallback(DeviceCallback callback) {
- DeviceListener deviceListener = new DeviceListener(callback);
+ public void registerDeviceCallback(DeviceCallback callback, Handler handler) {
+ DeviceListener deviceListener = new DeviceListener(callback, handler);
try {
mService.registerListener(mToken, deviceListener);
} catch (RemoteException e) {
@@ -143,7 +167,7 @@ public class MidiManager {
/**
* Opens a MIDI device for reading and writing.
*
- * @param deviceInfo a {@link android.midi.MidiDeviceInfo} to open
+ * @param deviceInfo a {@link android.media.midi.MidiDeviceInfo} to open
* @return a {@link MidiDevice} object for the device
*/
public MidiDevice openDevice(MidiDeviceInfo deviceInfo) {
diff --git a/core/java/android/midi/MidiOutputPort.java b/media/java/android/media/midi/MidiOutputPort.java
index b9512fd80612..83ddeebaeba1 100644
--- a/core/java/android/midi/MidiOutputPort.java
+++ b/media/java/android/media/midi/MidiOutputPort.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.midi;
+package android.media.midi;
import android.os.ParcelFileDescriptor;
import android.util.Log;
diff --git a/core/java/android/midi/MidiPort.java b/media/java/android/media/midi/MidiPort.java
index 7512a9099d18..4d3c91d8c82d 100644
--- a/core/java/android/midi/MidiPort.java
+++ b/media/java/android/media/midi/MidiPort.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.midi;
+package android.media.midi;
import android.util.Log;
@@ -33,12 +33,16 @@ abstract public class MidiPort implements Closeable {
private final int mPortNumber;
/**
- * Maximum size of a packet that can pass through our ParcelFileDescriptor
+ * Maximum size of a packet that can pass through our ParcelFileDescriptor.
+ * For internal use only. Implementation details may change in the future.
+ * @hide
*/
- protected static final int MAX_PACKET_SIZE = 1024;
+ public static final int MAX_PACKET_SIZE = 1024;
/**
* size of message timestamp in bytes
+ * For internal use only. Implementation details may change in the future.
+ * @hide
*/
private static final int TIMESTAMP_SIZE = 8;
@@ -65,6 +69,7 @@ abstract public class MidiPort implements Closeable {
* Called when an IOExeption occurs while sending or receiving data.
* Subclasses can override to be notified of such errors
*
+ * @hide
*/
public void onIOException() {
}
@@ -77,8 +82,11 @@ abstract public class MidiPort implements Closeable {
* timestamp is message timestamp to pack
* dest is buffer to pack into
* returns size of packed message
+ *
+ * For internal use only. Implementation details may change in the future.
+ * @hide
*/
- protected static int packMessage(byte[] message, int offset, int size, long timestamp,
+ public static int packMessage(byte[] message, int offset, int size, long timestamp,
byte[] dest) {
if (size + TIMESTAMP_SIZE > MAX_PACKET_SIZE) {
size = MAX_PACKET_SIZE - TIMESTAMP_SIZE;
@@ -98,8 +106,11 @@ abstract public class MidiPort implements Closeable {
/**
* Utility function for unpacking a MIDI message received from our ParcelFileDescriptor
* returns the offset of the MIDI message in packed buffer
+ *
+ * For internal use only. Implementation details may change in the future.
+ * @hide
*/
- protected static int getMessageOffset(byte[] buffer, int bufferLength) {
+ public static int getMessageOffset(byte[] buffer, int bufferLength) {
// message is at the beginning
return 0;
}
@@ -107,8 +118,11 @@ abstract public class MidiPort implements Closeable {
/**
* Utility function for unpacking a MIDI message received from our ParcelFileDescriptor
* returns size of MIDI data in packed buffer
+ *
+ * For internal use only. Implementation details may change in the future.
+ * @hide
*/
- protected static int getMessageSize(byte[] buffer, int bufferLength) {
+ public static int getMessageSize(byte[] buffer, int bufferLength) {
// message length is total buffer length minus size of the timestamp
return bufferLength - TIMESTAMP_SIZE;
}
@@ -116,8 +130,11 @@ abstract public class MidiPort implements Closeable {
/**
* Utility function for unpacking a MIDI message received from our ParcelFileDescriptor
* unpacks timestamp from packed buffer
+ *
+ * For internal use only. Implementation details may change in the future.
+ * @hide
*/
- protected static long getMessageTimeStamp(byte[] buffer, int bufferLength) {
+ public static long getMessageTimeStamp(byte[] buffer, int bufferLength) {
// timestamp is at end of the packet
int offset = bufferLength;
long timestamp = 0;
diff --git a/core/java/android/midi/MidiReceiver.java b/media/java/android/media/midi/MidiReceiver.java
index 16c9bbbc4674..64c0c072fa40 100644
--- a/core/java/android/midi/MidiReceiver.java
+++ b/media/java/android/media/midi/MidiReceiver.java
@@ -14,12 +14,12 @@
* limitations under the License.
*/
-package android.midi;
+package android.media.midi;
import java.io.IOException;
/**
- * Interface for receiving data from a MIDI device.
+ * Interface for sending and receiving data to and from a MIDI device.
*
* CANDIDATE FOR PUBLIC API
* @hide
diff --git a/core/java/android/midi/MidiSender.java b/media/java/android/media/midi/MidiSender.java
index 2b7afad11fe6..455047670167 100644
--- a/core/java/android/midi/MidiSender.java
+++ b/media/java/android/media/midi/MidiSender.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.midi;
+package android.media.midi;
/**
* Interface provided by a device to allow attaching
diff --git a/services/core/java/com/android/server/MidiService.java b/services/core/java/com/android/server/MidiService.java
index 38f1cb80296c..04911fa9fbea 100644
--- a/services/core/java/com/android/server/MidiService.java
+++ b/services/core/java/com/android/server/MidiService.java
@@ -17,10 +17,10 @@
package com.android.server;
import android.content.Context;
-import android.midi.IMidiDeviceServer;
-import android.midi.IMidiListener;
-import android.midi.IMidiManager;
-import android.midi.MidiDeviceInfo;
+import android.media.midi.IMidiDeviceServer;
+import android.media.midi.IMidiListener;
+import android.media.midi.IMidiManager;
+import android.media.midi.MidiDeviceInfo;
import android.os.Binder;
import android.os.Bundle;
import android.os.IBinder;
diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java
index 7afe23aafdb8..83a7b68b32e5 100644
--- a/services/core/java/com/android/server/am/ActivityStack.java
+++ b/services/core/java/com/android/server/am/ActivityStack.java
@@ -4162,14 +4162,17 @@ final class ActivityStack {
if (mTaskHistory.isEmpty()) {
if (DEBUG_STACK) Slog.i(TAG, "removeTask: moving to back stack=" + this);
+ final boolean notHomeStack = !isHomeStack();
if (isOnHomeDisplay()) {
- mStackSupervisor.moveHomeStack(!isHomeStack(), reason + " leftTaskHistoryEmpty");
+ mStackSupervisor.moveHomeStack(notHomeStack, reason + " leftTaskHistoryEmpty");
}
if (mStacks != null) {
mStacks.remove(this);
mStacks.add(0, this);
}
- mActivityContainer.onTaskListEmptyLocked();
+ if (notHomeStack) {
+ mActivityContainer.onTaskListEmptyLocked();
+ }
}
task.stack = null;
diff --git a/services/usb/java/com/android/server/usb/UsbAlsaManager.java b/services/usb/java/com/android/server/usb/UsbAlsaManager.java
index 009d25d01e71..0aa8862989b7 100644
--- a/services/usb/java/com/android/server/usb/UsbAlsaManager.java
+++ b/services/usb/java/com/android/server/usb/UsbAlsaManager.java
@@ -26,7 +26,7 @@ import android.hardware.usb.UsbDevice;
import android.hardware.usb.UsbInterface;
import android.media.AudioSystem;
import android.media.IAudioService;
-import android.midi.MidiDeviceInfo;
+import android.media.midi.MidiDeviceInfo;
import android.os.FileObserver;
import android.os.Bundle;
import android.os.IBinder;
diff --git a/services/usb/java/com/android/server/usb/UsbDeviceManager.java b/services/usb/java/com/android/server/usb/UsbDeviceManager.java
index be115b248f77..43c7336b75c2 100644
--- a/services/usb/java/com/android/server/usb/UsbDeviceManager.java
+++ b/services/usb/java/com/android/server/usb/UsbDeviceManager.java
@@ -31,7 +31,6 @@ import android.database.ContentObserver;
import android.hardware.usb.UsbAccessory;
import android.hardware.usb.UsbManager;
import android.media.AudioManager;
-import android.midi.MidiDeviceInfo;
import android.os.FileUtils;
import android.os.Handler;
import android.os.Looper;
diff --git a/services/usb/java/com/android/server/usb/UsbMidiDevice.java b/services/usb/java/com/android/server/usb/UsbMidiDevice.java
index 396ed38a3d07..e17abc006e80 100644
--- a/services/usb/java/com/android/server/usb/UsbMidiDevice.java
+++ b/services/usb/java/com/android/server/usb/UsbMidiDevice.java
@@ -17,12 +17,12 @@
package com.android.server.usb;
import android.content.Context;
-import android.midi.MidiDeviceInfo;
-import android.midi.MidiDeviceServer;
-import android.midi.MidiManager;
-import android.midi.MidiPort;
-import android.midi.MidiReceiver;
-import android.midi.MidiSender;
+import android.media.midi.MidiDeviceInfo;
+import android.media.midi.MidiDeviceServer;
+import android.media.midi.MidiManager;
+import android.media.midi.MidiPort;
+import android.media.midi.MidiReceiver;
+import android.media.midi.MidiSender;
import android.os.Bundle;
import android.system.ErrnoException;
import android.system.Os;