Merge "clearChoices when setting AbsListView adapters."
diff --git a/core/java/android/companion/CompanionDeviceManager.java b/core/java/android/companion/CompanionDeviceManager.java
index 86a30cf..076deab 100644
--- a/core/java/android/companion/CompanionDeviceManager.java
+++ b/core/java/android/companion/CompanionDeviceManager.java
@@ -280,12 +280,24 @@
@Override
public void onSuccess(PendingIntent launcher) {
- mHandler.post(() -> mCallback.onDeviceFound(launcher.getIntentSender()));
+ Handler handler = mHandler;
+ if (handler == null) return;
+ handler.post(() -> {
+ Callback callback = mCallback;
+ if (callback == null) return;
+ callback.onDeviceFound(launcher.getIntentSender());
+ });
}
@Override
public void onFailure(CharSequence reason) {
- mHandler.post(() -> mCallback.onFailure(reason));
+ Handler handler = mHandler;
+ if (handler == null) return;
+ handler.post(() -> {
+ Callback callback = mCallback;
+ if (callback == null) return;
+ callback.onFailure(reason);
+ });
}
@Override
diff --git a/core/java/com/android/internal/widget/ImageFloatingTextView.java b/core/java/com/android/internal/widget/ImageFloatingTextView.java
index 6b53368..31b167d 100644
--- a/core/java/com/android/internal/widget/ImageFloatingTextView.java
+++ b/core/java/com/android/internal/widget/ImageFloatingTextView.java
@@ -22,6 +22,7 @@
import android.text.Layout;
import android.text.StaticLayout;
import android.text.TextUtils;
+import android.text.method.TransformationMethod;
import android.util.AttributeSet;
import android.view.RemotableViewMethod;
import android.widget.RemoteViews;
@@ -68,7 +69,12 @@
protected Layout makeSingleLayout(int wantWidth, BoringLayout.Metrics boring, int ellipsisWidth,
Layout.Alignment alignment, boolean shouldEllipsize,
TextUtils.TruncateAt effectiveEllipsize, boolean useSaved) {
- CharSequence text = getText() == null ? "" : getText();
+ TransformationMethod transformationMethod = getTransformationMethod();
+ CharSequence text = getText();
+ if (transformationMethod != null) {
+ text = transformationMethod.getTransformation(text, this);
+ }
+ text = text == null ? "" : text;
StaticLayout.Builder builder = StaticLayout.Builder.obtain(text, 0, text.length(),
getPaint(), wantWidth)
.setAlignment(alignment)
diff --git a/core/jni/android/graphics/Bitmap.cpp b/core/jni/android/graphics/Bitmap.cpp
index be8b9de..61e138e 100755
--- a/core/jni/android/graphics/Bitmap.cpp
+++ b/core/jni/android/graphics/Bitmap.cpp
@@ -485,11 +485,9 @@
//////////////////// ToColor procs
-typedef void (*ToColorProc)(SkColor dst[], const void* src, int width,
- SkColorTable*);
+typedef void (*ToColorProc)(SkColor dst[], const void* src, int width);
-static void ToColor_F16_Alpha(SkColor dst[], const void* src, int width,
- SkColorTable*) {
+static void ToColor_F16_Alpha(SkColor dst[], const void* src, int width) {
SkASSERT(width > 0);
uint64_t* s = (uint64_t*)src;
do {
@@ -497,8 +495,7 @@
} while (--width != 0);
}
-static void ToColor_F16_Raw(SkColor dst[], const void* src, int width,
- SkColorTable*) {
+static void ToColor_F16_Raw(SkColor dst[], const void* src, int width) {
SkASSERT(width > 0);
uint64_t* s = (uint64_t*)src;
do {
@@ -506,8 +503,7 @@
} while (--width != 0);
}
-static void ToColor_S32_Alpha(SkColor dst[], const void* src, int width,
- SkColorTable*) {
+static void ToColor_S32_Alpha(SkColor dst[], const void* src, int width) {
SkASSERT(width > 0);
const SkPMColor* s = (const SkPMColor*)src;
do {
@@ -515,8 +511,7 @@
} while (--width != 0);
}
-static void ToColor_S32_Raw(SkColor dst[], const void* src, int width,
- SkColorTable*) {
+static void ToColor_S32_Raw(SkColor dst[], const void* src, int width) {
SkASSERT(width > 0);
const SkPMColor* s = (const SkPMColor*)src;
do {
@@ -526,8 +521,7 @@
} while (--width != 0);
}
-static void ToColor_S32_Opaque(SkColor dst[], const void* src, int width,
- SkColorTable*) {
+static void ToColor_S32_Opaque(SkColor dst[], const void* src, int width) {
SkASSERT(width > 0);
const SkPMColor* s = (const SkPMColor*)src;
do {
@@ -537,8 +531,7 @@
} while (--width != 0);
}
-static void ToColor_S4444_Alpha(SkColor dst[], const void* src, int width,
- SkColorTable*) {
+static void ToColor_S4444_Alpha(SkColor dst[], const void* src, int width) {
SkASSERT(width > 0);
const SkPMColor16* s = (const SkPMColor16*)src;
do {
@@ -546,8 +539,7 @@
} while (--width != 0);
}
-static void ToColor_S4444_Raw(SkColor dst[], const void* src, int width,
- SkColorTable*) {
+static void ToColor_S4444_Raw(SkColor dst[], const void* src, int width) {
SkASSERT(width > 0);
const SkPMColor16* s = (const SkPMColor16*)src;
do {
@@ -557,8 +549,7 @@
} while (--width != 0);
}
-static void ToColor_S4444_Opaque(SkColor dst[], const void* src, int width,
- SkColorTable*) {
+static void ToColor_S4444_Opaque(SkColor dst[], const void* src, int width) {
SkASSERT(width > 0);
const SkPMColor16* s = (const SkPMColor16*)src;
do {
@@ -568,8 +559,7 @@
} while (--width != 0);
}
-static void ToColor_S565(SkColor dst[], const void* src, int width,
- SkColorTable*) {
+static void ToColor_S565(SkColor dst[], const void* src, int width) {
SkASSERT(width > 0);
const uint16_t* s = (const uint16_t*)src;
do {
@@ -579,41 +569,7 @@
} while (--width != 0);
}
-static void ToColor_SI8_Alpha(SkColor dst[], const void* src, int width,
- SkColorTable* ctable) {
- SkASSERT(width > 0);
- const uint8_t* s = (const uint8_t*)src;
- const SkPMColor* colors = ctable->readColors();
- do {
- *dst++ = SkUnPreMultiply::PMColorToColor(colors[*s++]);
- } while (--width != 0);
-}
-
-static void ToColor_SI8_Raw(SkColor dst[], const void* src, int width,
- SkColorTable* ctable) {
- SkASSERT(width > 0);
- const uint8_t* s = (const uint8_t*)src;
- const SkPMColor* colors = ctable->readColors();
- do {
- SkPMColor c = colors[*s++];
- *dst++ = SkColorSetARGB(SkGetPackedA32(c), SkGetPackedR32(c),
- SkGetPackedG32(c), SkGetPackedB32(c));
- } while (--width != 0);
-}
-
-static void ToColor_SI8_Opaque(SkColor dst[], const void* src, int width,
- SkColorTable* ctable) {
- SkASSERT(width > 0);
- const uint8_t* s = (const uint8_t*)src;
- const SkPMColor* colors = ctable->readColors();
- do {
- SkPMColor c = colors[*s++];
- *dst++ = SkColorSetRGB(SkGetPackedR32(c), SkGetPackedG32(c),
- SkGetPackedB32(c));
- } while (--width != 0);
-}
-
-static void ToColor_SA8(SkColor dst[], const void* src, int width, SkColorTable*) {
+static void ToColor_SA8(SkColor dst[], const void* src, int width) {
SkASSERT(width > 0);
const uint8_t* s = (const uint8_t*)src;
do {
@@ -649,20 +605,6 @@
}
case kRGB_565_SkColorType:
return ToColor_S565;
- case kIndex_8_SkColorType:
- if (src.getColorTable() == NULL) {
- return NULL;
- }
- switch (src.alphaType()) {
- case kOpaque_SkAlphaType:
- return ToColor_SI8_Opaque;
- case kPremul_SkAlphaType:
- return ToColor_SI8_Alpha;
- case kUnpremul_SkAlphaType:
- return ToColor_SI8_Raw;
- default:
- return NULL;
- }
case kAlpha_8_SkColorType:
return ToColor_SA8;
case kRGBA_F16_SkColorType:
@@ -738,7 +680,7 @@
bitmap.setInfo(SkImageInfo::Make(width, height, colorType, kPremul_SkAlphaType, colorSpace));
- sk_sp<Bitmap> nativeBitmap = Bitmap::allocateHeapBitmap(&bitmap, NULL);
+ sk_sp<Bitmap> nativeBitmap = Bitmap::allocateHeapBitmap(&bitmap);
if (!nativeBitmap) {
return NULL;
}
@@ -752,8 +694,6 @@
static bool bitmapCopyTo(SkBitmap* dst, SkColorType dstCT, const SkBitmap& src,
SkBitmap::Allocator* alloc) {
- LOG_ALWAYS_FATAL_IF(kIndex_8_SkColorType == dstCT, "Error, cannot copyTo kIndex8.");
-
SkPixmap srcPM;
if (!src.peekPixels(&srcPM)) {
return false;
@@ -766,7 +706,7 @@
// allow the call to readPixels() to succeed and preserve this lenient behavior.
if (kOpaque_SkAlphaType != srcPM.alphaType()) {
srcPM = SkPixmap(srcPM.info().makeAlphaType(kOpaque_SkAlphaType), srcPM.addr(),
- srcPM.rowBytes(), srcPM.ctable());
+ srcPM.rowBytes());
dstInfo = dstInfo.makeAlphaType(kOpaque_SkAlphaType);
}
break;
@@ -800,7 +740,7 @@
for (int y = 0; y < src.height(); y++) {
const uint8_t* srcRow = srcPM.addr8(0, y);
uint32_t* dstRow = dst->getAddr32(0, y);
- ToColor_SA8(dstRow, srcRow, src.width(), nullptr);
+ ToColor_SA8(dstRow, srcRow, src.width());
}
return true;
}
@@ -1099,7 +1039,6 @@
kRGBA_F16_SkColorType != colorType &&
kRGB_565_SkColorType != colorType &&
kARGB_4444_SkColorType != colorType &&
- kIndex_8_SkColorType != colorType &&
kAlpha_8_SkColorType != colorType) {
SkDebugf("Bitmap_createFromParcel unknown colortype: %d\n", colorType);
return NULL;
@@ -1111,24 +1050,6 @@
return NULL;
}
- sk_sp<SkColorTable> ctable = NULL;
- if (colorType == kIndex_8_SkColorType) {
- int count = p->readInt32();
- if (count < 0 || count > 256) {
- // The data is corrupt, since SkColorTable enforces a value between 0 and 256,
- // inclusive.
- return NULL;
- }
- if (count > 0) {
- size_t size = count * sizeof(SkPMColor);
- const SkPMColor* src = (const SkPMColor*)p->readInplace(size);
- if (src == NULL) {
- return NULL;
- }
- ctable = SkColorTable::Make(src, count);
- }
- }
-
// Read the bitmap blob.
size_t size = bitmap->getSize();
android::Parcel::ReadableBlob blob;
@@ -1160,7 +1081,7 @@
// Map the pixels in place and take ownership of the ashmem region.
nativeBitmap = sk_sp<Bitmap>(GraphicsJNI::mapAshmemBitmap(env, bitmap.get(),
- ctable.get(), dupFd, const_cast<void*>(blob.data()), size, !isMutable));
+ nullptr, dupFd, const_cast<void*>(blob.data()), size, !isMutable));
if (!nativeBitmap) {
close(dupFd);
blob.release();
@@ -1185,7 +1106,7 @@
#endif
// Copy the pixels into a new buffer.
- nativeBitmap = Bitmap::allocateHeapBitmap(bitmap.get(), ctable);
+ nativeBitmap = Bitmap::allocateHeapBitmap(bitmap.get());
if (!nativeBitmap) {
blob.release();
doThrowRE(env, "Could not allocate java pixel ref.");
@@ -1240,19 +1161,6 @@
p->writeInt32(bitmap.rowBytes());
p->writeInt32(density);
- if (bitmap.colorType() == kIndex_8_SkColorType) {
- // The bitmap needs to be locked to access its color table.
- SkColorTable* ctable = bitmap.getColorTable();
- if (ctable != NULL) {
- int count = ctable->count();
- p->writeInt32(count);
- memcpy(p->writeInplace(count * sizeof(SkPMColor)),
- ctable->readColors(), count * sizeof(SkPMColor));
- } else {
- p->writeInt32(0); // indicate no ctable
- }
- }
-
// Transfer the underlying ashmem region if we have one and it's immutable.
android::status_t status;
int fd = bitmapWrapper->bitmap().getAshmemFd();
@@ -1394,7 +1302,7 @@
}
SkColor dst[1];
- proc(dst, src, 1, bitmap.getColorTable());
+ proc(dst, src, 1);
SkColorSpace* colorSpace = bitmap.colorSpace();
if (bitmap.colorType() != kRGBA_F16_SkColorType &&
@@ -1424,7 +1332,6 @@
return;
}
- SkColorTable* ctable = bitmap.getColorTable();
jint* dst = env->GetIntArrayElements(pixelArray, NULL);
SkColor* d = (SkColor*)dst + offset;
@@ -1432,7 +1339,7 @@
if (bitmap.colorType() == kRGBA_F16_SkColorType ||
GraphicsJNI::isColorSpaceSRGB(colorSpace)) {
while (--height >= 0) {
- proc(d, src, width, ctable);
+ proc(d, src, width);
d += stride;
src = (void*)((const char*)src + bitmap.rowBytes());
}
@@ -1441,7 +1348,7 @@
auto xform = SkColorSpaceXform::New(colorSpace, sRGB.get());
while (--height >= 0) {
- proc(d, src, width, ctable);
+ proc(d, src, width);
xform->apply(SkColorSpaceXform::kBGRA_8888_ColorFormat, d,
SkColorSpaceXform::kBGRA_8888_ColorFormat, d, width,
@@ -1551,22 +1458,6 @@
return JNI_FALSE;
}
- if (bm0.colorType() == kIndex_8_SkColorType) {
- SkColorTable* ct0 = bm0.getColorTable();
- SkColorTable* ct1 = bm1.getColorTable();
- if (NULL == ct0 || NULL == ct1) {
- return JNI_FALSE;
- }
- if (ct0->count() != ct1->count()) {
- return JNI_FALSE;
- }
-
- const size_t size = ct0->count() * sizeof(SkPMColor);
- if (memcmp(ct0->readColors(), ct1->readColors(), size) != 0) {
- return JNI_FALSE;
- }
- }
-
// now compare each scanline. We can't do the entire buffer at once,
// since we don't care about the pixel values that might extend beyond
// the width (since the scanline might be larger than the logical width)
diff --git a/core/jni/android/graphics/BitmapFactory.cpp b/core/jni/android/graphics/BitmapFactory.cpp
index 0a0e5f4..6ea5e9d 100644
--- a/core/jni/android/graphics/BitmapFactory.cpp
+++ b/core/jni/android/graphics/BitmapFactory.cpp
@@ -136,7 +136,7 @@
: mScale(scale), mSize(size) {
}
- virtual bool allocPixelRef(SkBitmap* bitmap, SkColorTable* ctable) {
+ virtual bool allocPixelRef(SkBitmap* bitmap, SkColorTable*) {
// accounts for scale in final allocation, using eventual size and config
const int bytesPerPixel = SkColorTypeBytesPerPixel(bitmap->colorType());
const int requestedSize = bytesPerPixel *
@@ -147,7 +147,7 @@
mSize, requestedSize);
return false;
}
- return SkBitmap::HeapAllocator::allocPixelRef(bitmap, ctable);
+ return SkBitmap::HeapAllocator::allocPixelRef(bitmap, nullptr);
}
private:
const float mScale;
@@ -163,7 +163,7 @@
~RecyclingPixelAllocator() {
}
- virtual bool allocPixelRef(SkBitmap* bitmap, SkColorTable* ctable) {
+ virtual bool allocPixelRef(SkBitmap* bitmap, SkColorTable*) {
const SkImageInfo& info = bitmap->info();
if (info.colorType() == kUnknown_SkColorType) {
ALOGW("unable to reuse a bitmap as the target has an unknown bitmap configuration");
@@ -183,7 +183,7 @@
return false;
}
- mBitmap->reconfigure(info, bitmap->rowBytes(), sk_ref_sp(ctable));
+ mBitmap->reconfigure(info, bitmap->rowBytes());
bitmap->setPixelRef(sk_ref_sp(mBitmap), 0, 0);
return true;
}
diff --git a/core/jni/android/graphics/Graphics.cpp b/core/jni/android/graphics/Graphics.cpp
index 5a2238f..ddd0821 100644
--- a/core/jni/android/graphics/Graphics.cpp
+++ b/core/jni/android/graphics/Graphics.cpp
@@ -327,8 +327,6 @@
return kARGB_4444_LegacyBitmapConfig;
case kRGB_565_SkColorType:
return kRGB_565_LegacyBitmapConfig;
- case kIndex_8_SkColorType:
- return kIndex8_LegacyBitmapConfig;
case kAlpha_8_SkColorType:
return kA8_LegacyBitmapConfig;
case kUnknown_SkColorType:
@@ -342,7 +340,7 @@
const uint8_t gConfig2ColorType[] = {
kUnknown_SkColorType,
kAlpha_8_SkColorType,
- kIndex_8_SkColorType,
+ kUnknown_SkColorType, // Previously kIndex_8_SkColorType,
kRGB_565_SkColorType,
kARGB_4444_SkColorType,
kN32_SkColorType,
@@ -435,7 +433,7 @@
///////////////////////////////////////////////////////////////////////////////
android::Bitmap* GraphicsJNI::mapAshmemBitmap(JNIEnv* env, SkBitmap* bitmap,
- SkColorTable* ctable, int fd, void* addr, size_t size, bool readOnly) {
+ SkColorTable*, int fd, void* addr, size_t size, bool readOnly) {
const SkImageInfo& info = bitmap->info();
if (info.colorType() == kUnknown_SkColorType) {
doThrowIAE(env, "unknown bitmap configuration");
@@ -456,7 +454,7 @@
// attempting to compute our own.
const size_t rowBytes = bitmap->rowBytes();
- auto wrapper = new android::Bitmap(addr, fd, size, info, rowBytes, sk_ref_sp(ctable));
+ auto wrapper = new android::Bitmap(addr, fd, size, info, rowBytes);
wrapper->getSkBitmap(bitmap);
if (readOnly) {
bitmap->pixelRef()->setImmutable();
@@ -609,8 +607,8 @@
}
///////////////////////////////////////////////////////////////////////////////
-bool HeapAllocator::allocPixelRef(SkBitmap* bitmap, SkColorTable* ctable) {
- mStorage = android::Bitmap::allocateHeapBitmap(bitmap, sk_ref_sp(ctable));
+bool HeapAllocator::allocPixelRef(SkBitmap* bitmap, SkColorTable*) {
+ mStorage = android::Bitmap::allocateHeapBitmap(bitmap);
return !!mStorage;
}
@@ -626,7 +624,7 @@
RecyclingClippingPixelAllocator::~RecyclingClippingPixelAllocator() {}
-bool RecyclingClippingPixelAllocator::allocPixelRef(SkBitmap* bitmap, SkColorTable* ctable) {
+bool RecyclingClippingPixelAllocator::allocPixelRef(SkBitmap* bitmap, SkColorTable*) {
// Ensure that the caller did not pass in a NULL bitmap to the constructor or this
// function.
LOG_ALWAYS_FATAL_IF(!mRecycledBitmap);
@@ -649,7 +647,7 @@
const size_t rowBytes = maxInfo.minRowBytes();
const size_t bytesNeeded = maxInfo.getSafeSize(rowBytes);
if (bytesNeeded <= mRecycledBytes) {
- // Here we take advantage of reconfigure() to reset the rowBytes and ctable
+ // Here we take advantage of reconfigure() to reset the rowBytes
// of mRecycledBitmap. It is very important that we pass in
// mRecycledBitmap->info() for the SkImageInfo. According to the
// specification for BitmapRegionDecoder, we are not allowed to change
@@ -658,7 +656,7 @@
// storage needs
mRecycledBitmap->reconfigure(
mRecycledBitmap->info().makeColorSpace(bitmap->refColorSpace()),
- rowBytes, sk_ref_sp(ctable));
+ rowBytes);
// Give the bitmap the same pixelRef as mRecycledBitmap.
// skbug.com/4538: We also need to make sure that the rowBytes on the pixel ref
@@ -685,7 +683,7 @@
// decode is complete.
mNeedsCopy = true;
- return heapAllocator.allocPixelRef(bitmap, ctable);
+ return heapAllocator.allocPixelRef(bitmap, nullptr);
}
void RecyclingClippingPixelAllocator::copyIfNecessary() {
@@ -716,8 +714,8 @@
"env->GetJavaVM failed");
}
-bool AshmemPixelAllocator::allocPixelRef(SkBitmap* bitmap, SkColorTable* ctable) {
- mStorage = android::Bitmap::allocateAshmemBitmap(bitmap, sk_ref_sp(ctable));
+bool AshmemPixelAllocator::allocPixelRef(SkBitmap* bitmap, SkColorTable*) {
+ mStorage = android::Bitmap::allocateAshmemBitmap(bitmap);
return !!mStorage;
}
diff --git a/core/jni/android/opengl/util.cpp b/core/jni/android/opengl/util.cpp
index 7c1ca81..d7345b0 100644
--- a/core/jni/android/opengl/util.cpp
+++ b/core/jni/android/opengl/util.cpp
@@ -623,9 +623,6 @@
static int checkFormat(SkColorType colorType, int format, int type)
{
switch(colorType) {
- case kIndex_8_SkColorType:
- if (format == GL_PALETTE8_RGBA8_OES)
- return 0;
case kN32_SkColorType:
case kAlpha_8_SkColorType:
if (type == GL_UNSIGNED_BYTE)
@@ -657,8 +654,6 @@
return GL_RGBA;
case kN32_SkColorType:
return GL_RGBA;
- case kIndex_8_SkColorType:
- return GL_PALETTE8_RGBA8_OES;
case kRGB_565_SkColorType:
return GL_RGB;
default:
@@ -675,8 +670,6 @@
return GL_UNSIGNED_SHORT_4_4_4_4;
case kN32_SkColorType:
return GL_UNSIGNED_BYTE;
- case kIndex_8_SkColorType:
- return -1; // No type for compressed data.
case kRGB_565_SkColorType:
return GL_UNSIGNED_SHORT_5_6_5;
default:
diff --git a/core/jni/android_graphics_Canvas.cpp b/core/jni/android_graphics_Canvas.cpp
index c0f719e..80f6abe 100644
--- a/core/jni/android_graphics_Canvas.cpp
+++ b/core/jni/android_graphics_Canvas.cpp
@@ -452,7 +452,7 @@
GraphicsJNI::defaultColorSpace());
SkBitmap bitmap;
bitmap.setInfo(info);
- sk_sp<Bitmap> androidBitmap = Bitmap::allocateHeapBitmap(&bitmap, NULL);
+ sk_sp<Bitmap> androidBitmap = Bitmap::allocateHeapBitmap(&bitmap);
if (!androidBitmap) {
return;
}
diff --git a/core/jni/android_view_SurfaceControl.cpp b/core/jni/android_view_SurfaceControl.cpp
index 5df6a28..1df6b4a3 100644
--- a/core/jni/android_view_SurfaceControl.cpp
+++ b/core/jni/android_view_SurfaceControl.cpp
@@ -246,7 +246,7 @@
auto bitmap = new Bitmap(
(void*) screenshot->getPixels(), (void*) screenshot.get(), DeleteScreenshot,
- screenshotInfo, rowBytes, nullptr);
+ screenshotInfo, rowBytes);
screenshot.release();
bitmap->setImmutable();
return bitmap::createBitmap(env, bitmap,
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index ba5af2f..e10570f 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -594,6 +594,14 @@
<!-- Boolean indicating that wifi only link configuratios that have exact same credentials (i.e PSK) -->
<bool translatable="false" name="config_wifi_only_link_same_credential_configurations">true</bool>
+ <!-- Boolean indicating whether framework needs to set the tx power limit for meeting SAR requirements
+ during voice calls -->
+ <bool translatable="false" name="config_wifi_framework_enable_voice_call_sar_tx_power_limit">false</bool>
+
+ <!-- Integer indicating the value that framework needs to set the tx power to for meeting SAR requirements
+ during voice calls -->
+ <integer translatable="false" name="config_wifi_framework_voice_call_sar_tx_power_limit_in_dbm">0</integer>
+
<!-- Wifi driver supports batched scan -->
<bool translatable="false" name="config_wifi_batched_scan_supported">false</bool>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 6d6064f..f8b6904 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -313,6 +313,8 @@
<java-symbol type="bool" name="config_windowEnableCircularEmulatorDisplayOverlay" />
<java-symbol type="bool" name="config_wifi_framework_enable_associated_network_selection" />
<java-symbol type="bool" name="config_wifi_only_link_same_credential_configurations" />
+ <java-symbol type="bool" name="config_wifi_framework_enable_voice_call_sar_tx_power_limit" />
+ <java-symbol type="integer" name="config_wifi_framework_voice_call_sar_tx_power_limit_in_dbm" />
<java-symbol type="bool" name="config_wifi_enable_disconnection_debounce" />
<java-symbol type="bool" name="config_wifi_revert_country_code_on_cellular_loss" />
<java-symbol type="bool" name="config_wifi_enable_wifi_firmware_debugging" />
diff --git a/core/tests/coretests/src/com/android/internal/widget/ImageFloatingTextViewTest.java b/core/tests/coretests/src/com/android/internal/widget/ImageFloatingTextViewTest.java
index a249925..1806b22 100644
--- a/core/tests/coretests/src/com/android/internal/widget/ImageFloatingTextViewTest.java
+++ b/core/tests/coretests/src/com/android/internal/widget/ImageFloatingTextViewTest.java
@@ -21,9 +21,11 @@
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.filters.SmallTest;
+import android.text.Layout;
import android.view.View.MeasureSpec;
import android.widget.TextView;
+import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -102,6 +104,16 @@
+ "Yada yada, yada yada. Lorem ipsum dolor sit amet.");
}
+ @Test
+ public void usesTransformationMethod() {
+ mView.setSingleLine();
+ String text = "Test \n Test";
+ parametrizedTest(text);
+ Layout layout = mView.getLayout();
+ Assert.assertFalse("The transformation method wasn't used, string is still the same",
+ text.equals(layout.getText()));
+ }
+
private void parametrizedTest(CharSequence text) {
int heightMeasureSpec = MeasureSpec.makeMeasureSpec(500, MeasureSpec.AT_MOST);
int widthMeasureSpec = MeasureSpec.makeMeasureSpec(500, MeasureSpec.EXACTLY);
diff --git a/libs/androidfw/ResourceTypes.cpp b/libs/androidfw/ResourceTypes.cpp
index 99ccc98..0782269 100644
--- a/libs/androidfw/ResourceTypes.cpp
+++ b/libs/androidfw/ResourceTypes.cpp
@@ -1901,6 +1901,8 @@
if (diff != 0) return diff;
diff = (int32_t)(screenSize - o.screenSize);
if (diff != 0) return diff;
+ diff = (int32_t)(version - o.version);
+ if (diff != 0) return diff;
diff = (int32_t)(screenLayout - o.screenLayout);
if (diff != 0) return diff;
diff = (int32_t)(screenLayout2 - o.screenLayout2);
@@ -1912,11 +1914,6 @@
diff = (int32_t)(smallestScreenWidthDp - o.smallestScreenWidthDp);
if (diff != 0) return diff;
diff = (int32_t)(screenSizeDp - o.screenSizeDp);
- if (diff != 0) return diff;
-
- // Version MUST be last to ensure that a sorted list of configurations will always have the
- // versions beside each other.
- diff = (int32_t)(version - o.version);
return (int)diff;
}
diff --git a/libs/hwui/Android.bp b/libs/hwui/Android.bp
index 113a477..842e053 100644
--- a/libs/hwui/Android.bp
+++ b/libs/hwui/Android.bp
@@ -302,7 +302,6 @@
"tests/unit/BakedOpDispatcherTests.cpp",
"tests/unit/BakedOpRendererTests.cpp",
"tests/unit/BakedOpStateTests.cpp",
- "tests/unit/BitmapTests.cpp",
"tests/unit/CacheManagerTests.cpp",
"tests/unit/CanvasContextTests.cpp",
"tests/unit/CanvasStateTests.cpp",
diff --git a/libs/hwui/Texture.cpp b/libs/hwui/Texture.cpp
index 4ef31d5..b7c1e29 100644
--- a/libs/hwui/Texture.cpp
+++ b/libs/hwui/Texture.cpp
@@ -217,9 +217,8 @@
*outType = GL_UNSIGNED_SHORT_5_6_5;
}
break;
- // ARGB_4444 and Index_8 are both upconverted to RGBA_8888
+ // ARGB_4444 is upconverted to RGBA_8888
case kARGB_4444_SkColorType:
- case kIndex_8_SkColorType:
case kN32_SkColorType:
*outFormat = GL_RGBA;
*outInternalFormat = caches.rgbaInternalFormat(needSRGB);
@@ -270,7 +269,6 @@
bool Texture::hasUnsupportedColorType(const SkImageInfo& info, bool hasLinearBlending) {
return info.colorType() == kARGB_4444_SkColorType
- || info.colorType() == kIndex_8_SkColorType
|| (info.colorType() == kRGB_565_SkColorType
&& hasLinearBlending
&& info.colorSpace()->isSRGB())
@@ -279,11 +277,6 @@
}
void Texture::upload(Bitmap& bitmap) {
- if (!bitmap.readyToDraw()) {
- ALOGE("Cannot generate texture from bitmap");
- return;
- }
-
ATRACE_FORMAT("Upload %ux%u Texture", bitmap.width(), bitmap.height());
// We could also enable mipmapping if both bitmap dimensions are powers
diff --git a/libs/hwui/hwui/Bitmap.cpp b/libs/hwui/hwui/Bitmap.cpp
index 6dde005..3a8914e 100644
--- a/libs/hwui/hwui/Bitmap.cpp
+++ b/libs/hwui/hwui/Bitmap.cpp
@@ -46,10 +46,10 @@
return true;
}
-typedef sk_sp<Bitmap> (*AllocPixeRef)(size_t allocSize, const SkImageInfo& info, size_t rowBytes,
- sk_sp<SkColorTable> ctable);
+typedef sk_sp<Bitmap> (*AllocPixelRef)(size_t allocSize, const SkImageInfo& info,
+ size_t rowBytes);
-static sk_sp<Bitmap> allocateBitmap(SkBitmap* bitmap, sk_sp<SkColorTable> ctable, AllocPixeRef alloc) {
+static sk_sp<Bitmap> allocateBitmap(SkBitmap* bitmap, AllocPixelRef alloc) {
const SkImageInfo& info = bitmap->info();
if (info.colorType() == kUnknown_SkColorType) {
LOG_ALWAYS_FATAL("unknown bitmap configuration");
@@ -65,32 +65,31 @@
return nullptr;
}
- auto wrapper = alloc(size, info, rowBytes, std::move(ctable));
+ auto wrapper = alloc(size, info, rowBytes);
if (wrapper) {
wrapper->getSkBitmap(bitmap);
}
return wrapper;
}
-sk_sp<Bitmap> Bitmap::allocateAshmemBitmap(SkBitmap* bitmap, sk_sp<SkColorTable> ctable) {
- return allocateBitmap(bitmap, std::move(ctable), &Bitmap::allocateAshmemBitmap);
+sk_sp<Bitmap> Bitmap::allocateAshmemBitmap(SkBitmap* bitmap) {
+ return allocateBitmap(bitmap, &Bitmap::allocateAshmemBitmap);
}
-static sk_sp<Bitmap> allocateHeapBitmap(size_t size, const SkImageInfo& info, size_t rowBytes,
- sk_sp<SkColorTable> ctable) {
+static sk_sp<Bitmap> allocateHeapBitmap(size_t size, const SkImageInfo& info, size_t rowBytes) {
void* addr = calloc(size, 1);
if (!addr) {
return nullptr;
}
- return sk_sp<Bitmap>(new Bitmap(addr, size, info, rowBytes, std::move(ctable)));
+ return sk_sp<Bitmap>(new Bitmap(addr, size, info, rowBytes));
}
sk_sp<Bitmap> Bitmap::allocateHardwareBitmap(SkBitmap& bitmap) {
return uirenderer::renderthread::RenderProxy::allocateHardwareBitmap(bitmap);
}
-sk_sp<Bitmap> Bitmap::allocateHeapBitmap(SkBitmap* bitmap, sk_sp<SkColorTable> ctable) {
- return allocateBitmap(bitmap, std::move(ctable), &android::allocateHeapBitmap);
+sk_sp<Bitmap> Bitmap::allocateHeapBitmap(SkBitmap* bitmap) {
+ return allocateBitmap(bitmap, &android::allocateHeapBitmap);
}
sk_sp<Bitmap> Bitmap::allocateHeapBitmap(const SkImageInfo& info) {
@@ -99,11 +98,11 @@
LOG_ALWAYS_FATAL("trying to allocate too large bitmap");
return nullptr;
}
- return android::allocateHeapBitmap(size, info, info.minRowBytes(), nullptr);
+ return android::allocateHeapBitmap(size, info, info.minRowBytes());
}
sk_sp<Bitmap> Bitmap::allocateAshmemBitmap(size_t size, const SkImageInfo& info,
- size_t rowBytes, sk_sp<SkColorTable> ctable) {
+ size_t rowBytes) {
// Create new ashmem region with read/write priv
int fd = ashmem_create_region("bitmap", size);
if (fd < 0) {
@@ -121,7 +120,7 @@
close(fd);
return nullptr;
}
- return sk_sp<Bitmap>(new Bitmap(addr, fd, size, info, rowBytes, std::move(ctable)));
+ return sk_sp<Bitmap>(new Bitmap(addr, fd, size, info, rowBytes));
}
void FreePixelRef(void* addr, void* context) {
@@ -132,7 +131,7 @@
sk_sp<Bitmap> Bitmap::createFrom(const SkImageInfo& info, SkPixelRef& pixelRef) {
pixelRef.ref();
return sk_sp<Bitmap>(new Bitmap((void*) pixelRef.pixels(), (void*) &pixelRef, FreePixelRef,
- info, pixelRef.rowBytes(), sk_ref_sp(pixelRef.colorTable())));
+ info, pixelRef.rowBytes()));
}
sk_sp<Bitmap> Bitmap::createFrom(sp<GraphicBuffer> graphicBuffer) {
@@ -161,11 +160,7 @@
return info.makeAlphaType(alphaType);
}
-void Bitmap::reconfigure(const SkImageInfo& newInfo, size_t rowBytes, sk_sp<SkColorTable> ctable) {
- if (kIndex_8_SkColorType != newInfo.colorType()) {
- ctable = nullptr;
- }
-
+void Bitmap::reconfigure(const SkImageInfo& newInfo, size_t rowBytes) {
mInfo = validateAlpha(newInfo);
// Dirty hack is dirty
@@ -173,20 +168,11 @@
// really hard to work with. Skia really, really wants immutable objects,
// but with the nested-ref-count hackery going on that's just not
// feasible without going insane trying to figure it out
- this->android_only_reset(mInfo.width(), mInfo.height(), rowBytes, std::move(ctable));
+ this->android_only_reset(mInfo.width(), mInfo.height(), rowBytes, nullptr);
}
-static sk_sp<SkColorTable> sanitize(const SkImageInfo& info, sk_sp<SkColorTable> ctable) {
- if (info.colorType() == kIndex_8_SkColorType) {
- SkASSERT(ctable);
- return ctable;
- }
- return nullptr; // drop the ctable if we're not indexed
-}
-Bitmap::Bitmap(void* address, size_t size, const SkImageInfo& info, size_t rowBytes,
- sk_sp<SkColorTable> ctable)
- : SkPixelRef(info.width(), info.height(), address, rowBytes,
- sanitize(info, std::move(ctable)))
+Bitmap::Bitmap(void* address, size_t size, const SkImageInfo& info, size_t rowBytes)
+ : SkPixelRef(info.width(), info.height(), address, rowBytes)
, mInfo(validateAlpha(info))
, mPixelStorageType(PixelStorageType::Heap) {
mPixelStorage.heap.address = address;
@@ -194,9 +180,8 @@
}
Bitmap::Bitmap(void* address, void* context, FreeFunc freeFunc,
- const SkImageInfo& info, size_t rowBytes, sk_sp<SkColorTable> ctable)
- : SkPixelRef(info.width(), info.height(), address, rowBytes,
- sanitize(info, std::move(ctable)))
+ const SkImageInfo& info, size_t rowBytes)
+ : SkPixelRef(info.width(), info.height(), address, rowBytes)
, mInfo(validateAlpha(info))
, mPixelStorageType(PixelStorageType::External) {
mPixelStorage.external.address = address;
@@ -205,9 +190,8 @@
}
Bitmap::Bitmap(void* address, int fd, size_t mappedSize,
- const SkImageInfo& info, size_t rowBytes, sk_sp<SkColorTable> ctable)
- : SkPixelRef(info.width(), info.height(), address, rowBytes,
- sanitize(info, std::move(ctable)))
+ const SkImageInfo& info, size_t rowBytes)
+ : SkPixelRef(info.width(), info.height(), address, rowBytes)
, mInfo(validateAlpha(info))
, mPixelStorageType(PixelStorageType::Ashmem) {
mPixelStorage.ashmem.address = address;
@@ -295,7 +279,7 @@
}
void Bitmap::reconfigure(const SkImageInfo& info) {
- reconfigure(info, info.minRowBytes(), nullptr);
+ reconfigure(info, info.minRowBytes());
}
void Bitmap::setAlphaType(SkAlphaType alphaType) {
diff --git a/libs/hwui/hwui/Bitmap.h b/libs/hwui/hwui/Bitmap.h
index 364240670..634e764 100644
--- a/libs/hwui/hwui/Bitmap.h
+++ b/libs/hwui/hwui/Bitmap.h
@@ -17,7 +17,6 @@
#include <SkBitmap.h>
#include <SkColorSpace.h>
-#include <SkColorTable.h>
#include <SkImage.h>
#include <SkImageInfo.h>
#include <SkPixelRef.h>
@@ -46,32 +45,31 @@
class ANDROID_API Bitmap : public SkPixelRef {
public:
- static sk_sp<Bitmap> allocateHeapBitmap(SkBitmap* bitmap, sk_sp<SkColorTable> ctable);
+ static sk_sp<Bitmap> allocateHeapBitmap(SkBitmap* bitmap);
static sk_sp<Bitmap> allocateHeapBitmap(const SkImageInfo& info);
static sk_sp<Bitmap> allocateHardwareBitmap(SkBitmap& bitmap);
- static sk_sp<Bitmap> allocateAshmemBitmap(SkBitmap* bitmap, sk_sp<SkColorTable> ctable);
+ static sk_sp<Bitmap> allocateAshmemBitmap(SkBitmap* bitmap);
static sk_sp<Bitmap> allocateAshmemBitmap(size_t allocSize, const SkImageInfo& info,
- size_t rowBytes, sk_sp<SkColorTable> ctable);
+ size_t rowBytes);
static sk_sp<Bitmap> createFrom(sp<GraphicBuffer> graphicBuffer);
static sk_sp<Bitmap> createFrom(const SkImageInfo&, SkPixelRef&);
- Bitmap(void* address, size_t allocSize, const SkImageInfo& info, size_t rowBytes,
- sk_sp<SkColorTable> ctable);
+ Bitmap(void* address, size_t allocSize, const SkImageInfo& info, size_t rowBytes);
Bitmap(void* address, void* context, FreeFunc freeFunc,
- const SkImageInfo& info, size_t rowBytes, sk_sp<SkColorTable> ctable);
+ const SkImageInfo& info, size_t rowBytes);
Bitmap(void* address, int fd, size_t mappedSize, const SkImageInfo& info,
- size_t rowBytes, sk_sp<SkColorTable> ctable);
+ size_t rowBytes);
Bitmap(GraphicBuffer* buffer, const SkImageInfo& info);
int rowBytesAsPixels() const {
return rowBytes() >> SkColorTypeShiftPerPixel(mInfo.colorType());
}
- void reconfigure(const SkImageInfo& info, size_t rowBytes, sk_sp<SkColorTable> ctable);
+ void reconfigure(const SkImageInfo& info, size_t rowBytes);
void reconfigure(const SkImageInfo& info);
void setColorSpace(sk_sp<SkColorSpace> colorSpace);
void setAlphaType(SkAlphaType alphaType);
@@ -92,10 +90,6 @@
void getBounds(SkRect* bounds) const;
- bool readyToDraw() const {
- return this->colorType() != kIndex_8_SkColorType || this->colorTable();
- }
-
bool isHardware() const {
return mPixelStorageType == PixelStorageType::Hardware;
}
diff --git a/libs/hwui/pipeline/skia/LayerDrawable.cpp b/libs/hwui/pipeline/skia/LayerDrawable.cpp
index 2ebfbcc..4feeb2d 100644
--- a/libs/hwui/pipeline/skia/LayerDrawable.cpp
+++ b/libs/hwui/pipeline/skia/LayerDrawable.cpp
@@ -18,6 +18,7 @@
#include "LayerDrawable.h"
#include "VkLayer.h"
+#include "GrBackendSurface.h"
#include "SkColorFilter.h"
#include "SkSurface.h"
#include "gl/GrGLTypes.h"
@@ -46,13 +47,10 @@
GrGLTextureInfo externalTexture;
externalTexture.fTarget = glLayer->getRenderTarget();
externalTexture.fID = glLayer->getTextureId();
- GrBackendTextureDesc textureDescription;
- textureDescription.fWidth = glLayer->getWidth();
- textureDescription.fHeight = glLayer->getHeight();
- textureDescription.fConfig = kRGBA_8888_GrPixelConfig;
- textureDescription.fOrigin = kTopLeft_GrSurfaceOrigin;
- textureDescription.fTextureHandle = reinterpret_cast<GrBackendObject>(&externalTexture);
- layerImage = SkImage::MakeFromTexture(context, textureDescription);
+ GrBackendTexture backendTexture(glLayer->getWidth(), glLayer->getHeight(),
+ kRGBA_8888_GrPixelConfig, externalTexture);
+ layerImage = SkImage::MakeFromTexture(context, backendTexture, kTopLeft_GrSurfaceOrigin,
+ kPremul_SkAlphaType, nullptr);
} else {
SkASSERT(layer->getApi() == Layer::Api::Vulkan);
VkLayer* vkLayer = static_cast<VkLayer*>(layer);
diff --git a/libs/hwui/pipeline/skia/SkiaOpenGLPipeline.cpp b/libs/hwui/pipeline/skia/SkiaOpenGLPipeline.cpp
index 6d5ef1d..10e637a 100644
--- a/libs/hwui/pipeline/skia/SkiaOpenGLPipeline.cpp
+++ b/libs/hwui/pipeline/skia/SkiaOpenGLPipeline.cpp
@@ -27,6 +27,8 @@
#include "SkiaProfileRenderer.h"
#include "utils/TraceUtils.h"
+#include <GrBackendSurface.h>
+
#include <cutils/properties.h>
#include <strings.h>
@@ -69,20 +71,17 @@
mEglManager.damageFrame(frame, dirty);
// setup surface for fbo0
- GrBackendRenderTargetDesc renderTargetDesc;
- renderTargetDesc.fWidth = frame.width();
- renderTargetDesc.fHeight = frame.height();
- renderTargetDesc.fConfig = kRGBA_8888_GrPixelConfig;
- renderTargetDesc.fOrigin = kBottomLeft_GrSurfaceOrigin;
- renderTargetDesc.fSampleCnt = 0;
- renderTargetDesc.fStencilBits = STENCIL_BUFFER_SIZE;
- renderTargetDesc.fRenderTargetHandle = 0;
+ GrGLFramebufferInfo fboInfo;
+ fboInfo.fFBOID = 0;
+
+ GrBackendRenderTarget backendRT(frame.width(), frame.height(), 0, STENCIL_BUFFER_SIZE,
+ kRGBA_8888_GrPixelConfig, fboInfo);
SkSurfaceProps props(0, kUnknown_SkPixelGeometry);
SkASSERT(mRenderThread.getGrContext() != nullptr);
sk_sp<SkSurface> surface(SkSurface::MakeFromBackendRenderTarget(
- mRenderThread.getGrContext(), renderTargetDesc, &props));
+ mRenderThread.getGrContext(), backendRT, kBottomLeft_GrSurfaceOrigin, nullptr, &props));
SkiaPipeline::updateLighting(lightGeometry, lightInfo);
renderFrame(*layerUpdateQueue, dirty, renderNodes, opaque, wideColorGamut,
@@ -270,8 +269,7 @@
switch (info.colorType()) {
case kRGBA_8888_SkColorType:
isSupported = true;
- // ARGB_4444 and Index_8 are both upconverted to RGBA_8888
- case kIndex_8_SkColorType:
+ // ARGB_4444 is upconverted to RGBA_8888
case kARGB_4444_SkColorType:
pixelFormat = PIXEL_FORMAT_RGBA_8888;
format = GL_RGBA;
diff --git a/libs/hwui/pipeline/skia/SkiaOpenGLReadback.cpp b/libs/hwui/pipeline/skia/SkiaOpenGLReadback.cpp
index e865b57..69b9c01fe 100644
--- a/libs/hwui/pipeline/skia/SkiaOpenGLReadback.cpp
+++ b/libs/hwui/pipeline/skia/SkiaOpenGLReadback.cpp
@@ -20,6 +20,7 @@
#include "Properties.h"
#include <SkCanvas.h>
#include <SkSurface.h>
+#include <GrBackendSurface.h>
#include <gl/GrGLInterface.h>
#include <gl/GrGLTypes.h>
#include <GLES2/gl2.h>
@@ -53,15 +54,11 @@
externalTexture.fTarget = GL_TEXTURE_EXTERNAL_OES;
externalTexture.fID = sourceTexId;
- GrBackendTextureDesc textureDescription;
- textureDescription.fWidth = imgWidth;
- textureDescription.fHeight = imgHeight;
- textureDescription.fConfig = kRGBA_8888_GrPixelConfig;
- textureDescription.fOrigin = kTopLeft_GrSurfaceOrigin;
- textureDescription.fTextureHandle = reinterpret_cast<GrBackendObject>(&externalTexture);
+ GrBackendTexture backendTexture(imgWidth, imgHeight, kRGBA_8888_GrPixelConfig, externalTexture);
CopyResult copyResult = CopyResult::UnknownError;
- sk_sp<SkImage> image(SkImage::MakeFromAdoptedTexture(grContext.get(), textureDescription));
+ sk_sp<SkImage> image(SkImage::MakeFromAdoptedTexture(grContext.get(), backendTexture,
+ kTopLeft_GrSurfaceOrigin));
if (image) {
// convert to Skia data structures
const SkRect bufferRect = SkRect::MakeIWH(imgWidth, imgHeight);
diff --git a/libs/hwui/renderthread/VulkanManager.cpp b/libs/hwui/renderthread/VulkanManager.cpp
index a745320..2195143 100644
--- a/libs/hwui/renderthread/VulkanManager.cpp
+++ b/libs/hwui/renderthread/VulkanManager.cpp
@@ -22,6 +22,7 @@
#include "renderstate/RenderState.h"
#include "utils/FatVector.h"
+#include <GrBackendSurface.h>
#include <GrContext.h>
#include <GrTypes.h>
#include <vk/GrVkTypes.h>
@@ -297,13 +298,9 @@
SkSurfaceProps props(0, kUnknown_SkPixelGeometry);
- bool wantSRGB = VK_FORMAT_R8G8B8A8_SRGB == format;
- GrPixelConfig config = wantSRGB ? kSRGBA_8888_GrPixelConfig : kRGBA_8888_GrPixelConfig;
-
// set up initial image layouts and create surfaces
surface->mImageInfos = new VulkanSurface::ImageInfo[surface->mImageCount];
for (uint32_t i = 0; i < surface->mImageCount; ++i) {
- GrBackendRenderTargetDesc desc;
GrVkImageInfo info;
info.fImage = surface->mImages[i];
info.fAlloc = { VK_NULL_HANDLE, 0, 0, 0 };
@@ -312,17 +309,11 @@
info.fFormat = format;
info.fLevelCount = 1;
- desc.fWidth = extent.width;
- desc.fHeight = extent.height;
- desc.fConfig = config;
- desc.fOrigin = kTopLeft_GrSurfaceOrigin;
- desc.fSampleCnt = 0;
- desc.fStencilBits = 0;
- desc.fRenderTargetHandle = (GrBackendObject) &info;
+ GrBackendRenderTarget backendRT(extent.width, extent.height, 0, 0, info);
VulkanSurface::ImageInfo& imageInfo = surface->mImageInfos[i];
imageInfo.mSurface = SkSurface::MakeFromBackendRenderTarget(mRenderThread.getGrContext(),
- desc, &props);
+ backendRT, kTopLeft_GrSurfaceOrigin, nullptr, &props);
}
SkASSERT(mCommandPool != VK_NULL_HANDLE);
diff --git a/libs/hwui/tests/common/BitmapAllocationTestUtils.h b/libs/hwui/tests/common/BitmapAllocationTestUtils.h
index 4892179..2988979 100644
--- a/libs/hwui/tests/common/BitmapAllocationTestUtils.h
+++ b/libs/hwui/tests/common/BitmapAllocationTestUtils.h
@@ -41,7 +41,7 @@
SkBitmap skBitmap;
SkImageInfo info = SkImageInfo::Make(width, height, colorType, kPremul_SkAlphaType);
skBitmap.setInfo(info);
- sk_sp<Bitmap> heapBitmap(Bitmap::allocateHeapBitmap(&skBitmap, nullptr));
+ sk_sp<Bitmap> heapBitmap(Bitmap::allocateHeapBitmap(&skBitmap));
setup(skBitmap);
return Bitmap::allocateHardwareBitmap(skBitmap);
}
@@ -73,4 +73,4 @@
} // namespace test
} // namespace uirenderer
-} // namespace android
\ No newline at end of file
+} // namespace android
diff --git a/libs/hwui/tests/common/TestUtils.h b/libs/hwui/tests/common/TestUtils.h
index 98d5fb3..f293631 100644
--- a/libs/hwui/tests/common/TestUtils.h
+++ b/libs/hwui/tests/common/TestUtils.h
@@ -189,7 +189,7 @@
static sk_sp<Bitmap> createBitmap(int width, int height, SkBitmap* outBitmap) {
SkImageInfo info = SkImageInfo::Make(width, height, kN32_SkColorType, kPremul_SkAlphaType);
outBitmap->setInfo(info);
- return Bitmap::allocateHeapBitmap(outBitmap, nullptr);
+ return Bitmap::allocateHeapBitmap(outBitmap);
}
static sp<DeferredLayerUpdater> createTextureLayerUpdater(
diff --git a/libs/hwui/tests/unit/BitmapTests.cpp b/libs/hwui/tests/unit/BitmapTests.cpp
deleted file mode 100644
index ed689bd..0000000
--- a/libs/hwui/tests/unit/BitmapTests.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2016 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.
- */
-
-#include <gtest/gtest.h>
-
-#include "hwui/Bitmap.h"
-
-#include <SkBitmap.h>
-#include <SkColorTable.h>
-#include <SkImageInfo.h>
-
-#include <tests/common/TestUtils.h>
-
-using namespace android;
-using namespace android::uirenderer;
-
-TEST(Bitmap, colorTableRefCounting) {
- const SkPMColor c[] = { SkPackARGB32(0x80, 0x80, 0, 0) };
- sk_sp<SkColorTable> ctable = SkColorTable::Make(c, SK_ARRAY_COUNT(c));
-
- SkBitmap* bm = new SkBitmap();
- bm->allocPixels(SkImageInfo::Make(1, 1, kIndex_8_SkColorType, kPremul_SkAlphaType),
- ctable);
- sk_sp<Bitmap> bitmap = Bitmap::allocateHeapBitmap(bm, ctable);
- EXPECT_FALSE(ctable->unique());
- delete bm;
- bitmap.reset();
- EXPECT_TRUE(ctable->unique());
-}
-
diff --git a/media/java/android/media/AudioSystem.java b/media/java/android/media/AudioSystem.java
index 1dcd214..bfb81a0 100644
--- a/media/java/android/media/AudioSystem.java
+++ b/media/java/android/media/AudioSystem.java
@@ -806,14 +806,14 @@
4, // STREAM_VOICE_CALL
7, // STREAM_SYSTEM
5, // STREAM_RING
- 11, // STREAM_MUSIC
+ 5, // STREAM_MUSIC
6, // STREAM_ALARM
5, // STREAM_NOTIFICATION
7, // STREAM_BLUETOOTH_SCO
7, // STREAM_SYSTEM_ENFORCED
- 11, // STREAM_DTMF
- 11, // STREAM_TTS
- 11, // STREAM_ACCESSIBILITY
+ 5, // STREAM_DTMF
+ 5, // STREAM_TTS
+ 5, // STREAM_ACCESSIBILITY
};
public static String streamToString(int stream) {
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java
index b88ee44..7708adb 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java
@@ -18,10 +18,10 @@
@SmallTest
@RunWith(AndroidJUnit4.class)
-@Ignore("Flaky")
public class NetworkControllerDataTest extends NetworkControllerBaseTest {
@Test
+ @Ignore("Flaky")
public void test3gDataIcon() {
setupDefaultSignal();
@@ -30,6 +30,7 @@
}
@Test
+ @Ignore("Flaky")
public void test2gDataIcon() {
setupDefaultSignal();
updateDataConnectionState(TelephonyManager.DATA_CONNECTED,
@@ -40,6 +41,7 @@
}
@Test
+ @Ignore("Flaky")
public void testCdmaDataIcon() {
setupDefaultSignal();
updateDataConnectionState(TelephonyManager.DATA_CONNECTED,
@@ -50,6 +52,7 @@
}
@Test
+ @Ignore("Flaky")
public void testEdgeDataIcon() {
setupDefaultSignal();
updateDataConnectionState(TelephonyManager.DATA_CONNECTED,
@@ -60,6 +63,7 @@
}
@Test
+ @Ignore("Flaky")
public void testLteDataIcon() {
setupDefaultSignal();
updateDataConnectionState(TelephonyManager.DATA_CONNECTED,
@@ -70,6 +74,7 @@
}
@Test
+ @Ignore("Flaky")
public void testHspaDataIcon() {
setupDefaultSignal();
updateDataConnectionState(TelephonyManager.DATA_CONNECTED,
@@ -80,6 +85,7 @@
}
@Test
+ @Ignore("Flaky")
public void testWfcNoDataIcon() {
setupDefaultSignal();
updateDataConnectionState(TelephonyManager.DATA_CONNECTED,
@@ -89,6 +95,7 @@
}
@Test
+ @Ignore("Flaky")
public void test4gDataIcon() {
// Switch to showing 4g icon and re-initialize the NetworkController.
mConfig.show4gForLte = true;
@@ -108,6 +115,7 @@
}
@Test
+ @Ignore("Flaky")
public void testDataDisabledIcon() {
setupNetworkController();
when(mMockTm.getDataEnabled(mSubId)).thenReturn(false);
@@ -120,6 +128,7 @@
}
@Test
+ @Ignore("Flaky")
public void testDataDisabledIcon_UserNotSetup() {
setupNetworkController();
when(mMockTm.getDataEnabled(mSubId)).thenReturn(false);
@@ -134,6 +143,7 @@
}
@Test
+ @Ignore("Flaky")
public void test4gDataIconConfigChange() {
setupDefaultSignal();
updateDataConnectionState(TelephonyManager.DATA_CONNECTED,
@@ -151,6 +161,7 @@
}
@Test
+ @Ignore("Flaky")
public void testDataChangeWithoutConnectionState() {
setupDefaultSignal();
updateDataConnectionState(TelephonyManager.DATA_CONNECTED,
@@ -167,6 +178,7 @@
}
@Test
+ @Ignore("Flaky")
public void testDataActivity() {
setupDefaultSignal();
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java
index 97a4061..9055022 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java
@@ -48,10 +48,10 @@
@SmallTest
@RunWith(AndroidJUnit4.class)
-@Ignore("Flaky")
public class NetworkControllerSignalTest extends NetworkControllerBaseTest {
@Test
+ @Ignore("Flaky")
public void testNoIconWithoutMobile() {
// Turn off mobile network support.
Mockito.when(mMockCm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE)).thenReturn(false);
@@ -66,6 +66,7 @@
}
@Test
+ @Ignore("Flaky")
public void testNoSimsIconPresent() {
// No Subscriptions.
mNetworkController.mMobileSignalControllers.clear();
@@ -75,6 +76,7 @@
}
@Test
+ @Ignore("Flaky")
public void testEmergencyOnly() {
setupDefaultSignal();
mNetworkController.recalculateEmergency();
@@ -86,6 +88,7 @@
}
@Test
+ @Ignore("Flaky")
public void testEmergencyOnlyNoSubscriptions() {
setupDefaultSignal();
setSubscriptions();
@@ -96,6 +99,7 @@
}
@Test
+ @Ignore("Flaky")
public void testNoEmergencyOnlyWrongSubscription() {
setupDefaultSignal();
setDefaultSubId(42);
@@ -104,6 +108,7 @@
}
@Test
+ @Ignore("Flaky")
public void testNoEmengencyNoSubscriptions() {
setupDefaultSignal();
setSubscriptions();
@@ -114,6 +119,7 @@
}
@Test
+ @Ignore("Flaky")
public void testNoSimlessIconWithoutMobile() {
// Turn off mobile network support.
Mockito.when(mMockCm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE)).thenReturn(false);
@@ -132,6 +138,7 @@
}
@Test
+ @Ignore("Flaky")
public void testSignalStrength() {
for (int testStrength = 0;
testStrength < SignalStrength.NUM_SIGNAL_STRENGTH_BINS; testStrength++) {
@@ -149,6 +156,7 @@
}
@Test
+ @Ignore("Flaky")
public void testCdmaSignalStrength() {
for (int testStrength = 0;
testStrength < SignalStrength.NUM_SIGNAL_STRENGTH_BINS; testStrength++) {
@@ -163,6 +171,7 @@
}
@Test
+ @Ignore("Flaky")
public void testSignalRoaming() {
for (int testStrength = 0;
testStrength < SignalStrength.NUM_SIGNAL_STRENGTH_BINS; testStrength++) {
@@ -177,6 +186,7 @@
}
@Test
+ @Ignore("Flaky")
public void testCdmaSignalRoaming() {
for (int testStrength = SignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
testStrength <= SignalStrength.SIGNAL_STRENGTH_GREAT; testStrength++) {
@@ -192,6 +202,7 @@
}
@Test
+ @Ignore("Flaky")
public void testQsSignalStrength() {
for (int testStrength = SignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
testStrength <= SignalStrength.SIGNAL_STRENGTH_GREAT; testStrength++) {
@@ -205,6 +216,7 @@
}
@Test
+ @Ignore("Flaky")
public void testCdmaQsSignalStrength() {
for (int testStrength = SignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
testStrength <= SignalStrength.SIGNAL_STRENGTH_GREAT; testStrength++) {
@@ -219,6 +231,7 @@
}
@Test
+ @Ignore("Flaky")
public void testNoBangWithWifi() {
setupDefaultSignal();
setConnectivity(mMobileSignalController.mTransportType, false, false);
@@ -230,6 +243,7 @@
// Some tests of actual NetworkController code, just internals not display stuff
// TODO: Put this somewhere else, maybe in its own file.
@Test
+ @Ignore("Flaky")
public void testHasCorrectMobileControllers() {
int[] testSubscriptions = new int[] { 1, 5, 3 };
int notTestSubscription = 0;
@@ -257,6 +271,7 @@
}
@Test
+ @Ignore("Flaky")
public void testSetCurrentSubscriptions() {
// We will not add one controller to make sure it gets created.
int indexToSkipController = 0;
@@ -310,6 +325,7 @@
}
@Test
+ @Ignore("Flaky")
public void testHistorySize() {
// Verify valid history size, otherwise it gits printed out the wrong order and whatnot.
assertEquals(0, SignalController.HISTORY_SIZE & (SignalController.HISTORY_SIZE - 1));
@@ -323,6 +339,7 @@
}
@Test
+ @Ignore("Flaky")
public void testOnReceive_stringsUpdatedAction_spn() {
String expectedMNetworkName = "Test";
Intent intent = createStringsUpdatedIntent(true /* showSpn */,
@@ -336,6 +353,7 @@
}
@Test
+ @Ignore("Flaky")
public void testOnReceive_stringsUpdatedAction_plmn() {
String expectedMNetworkName = "Test";
@@ -350,6 +368,7 @@
}
@Test
+ @Ignore("Flaky")
public void testOnReceive_stringsUpdatedAction_bothFalse() {
Intent intent = createStringsUpdatedIntent(false /* showSpn */,
"Irrelevant" /* spn */,
@@ -365,6 +384,7 @@
}
@Test
+ @Ignore("Flaky")
public void testOnReceive_stringsUpdatedAction_bothTrueAndNull() {
Intent intent = createStringsUpdatedIntent(true /* showSpn */,
null /* spn */,
@@ -379,6 +399,7 @@
}
@Test
+ @Ignore("Flaky")
public void testOnReceive_stringsUpdatedAction_bothTrueAndNonNull() {
String spn = "Test1";
String plmn = "Test2";
@@ -413,6 +434,7 @@
}
@Test
+ @Ignore("Flaky")
public void testOnUpdateDataActivity_dataIn() {
setupDefaultSignal();
@@ -427,6 +449,7 @@
}
@Test
+ @Ignore("Flaky")
public void testOnUpdateDataActivity_dataOut() {
setupDefaultSignal();
@@ -440,6 +463,7 @@
}
@Test
+ @Ignore("Flaky")
public void testOnUpdateDataActivity_dataInOut() {
setupDefaultSignal();
@@ -454,6 +478,7 @@
}
@Test
+ @Ignore("Flaky")
public void testOnUpdateDataActivity_dataActivityNone() {
setupDefaultSignal();
@@ -468,6 +493,7 @@
}
@Test
+ @Ignore("Flaky")
public void testCarrierNetworkChange_carrierNetworkChange() {
int strength = SignalStrength.SIGNAL_STRENGTH_GREAT;
@@ -497,6 +523,7 @@
}
@Test
+ @Ignore("Flaky")
public void testCarrierNetworkChange_roamingBeforeNetworkChange() {
int strength = SignalStrength.SIGNAL_STRENGTH_GREAT;
@@ -530,6 +557,7 @@
}
@Test
+ @Ignore("Flaky")
public void testCarrierNetworkChange_roamingAfterNetworkChange() {
int strength = SignalStrength.SIGNAL_STRENGTH_GREAT;
diff --git a/proto/src/wifi.proto b/proto/src/wifi.proto
index fbb1a57..28e3427 100644
--- a/proto/src/wifi.proto
+++ b/proto/src/wifi.proto
@@ -258,6 +258,24 @@
// Wi-Fi Aware metrics
optional WifiAwareLog wifi_aware_log = 57;
+
+ // Number of saved Passpoint providers in user profile.
+ optional int32 num_passpoint_providers = 58;
+
+ // Count of times Passpoint provider being installed.
+ optional int32 num_passpoint_provider_installation = 59;
+
+ // Count of times Passpoint provivider is installed successfully.
+ optional int32 num_passpoint_provider_install_success = 60;
+
+ // Count of times Passpoint provider is being uninstalled.
+ optional int32 num_passpoint_provider_uninstallation = 61;
+
+ // Count of times Passpoint provider is uninstalled successfully.
+ optional int32 num_passpoint_provider_uninstall_success = 62;
+
+ // Count of saved Passpoint providers device has ever connected to.
+ optional int32 num_passpoint_providers_successfully_connected = 63;
}
// Information that gets logged for every WiFi connection.
diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java
index 834b964..0d3ee93 100644
--- a/services/core/java/com/android/server/audio/AudioService.java
+++ b/services/core/java/com/android/server/audio/AudioService.java
@@ -675,20 +675,29 @@
mHasVibrator = vibrator == null ? false : vibrator.hasVibrator();
// Initialize volume
- int maxVolume = SystemProperties.getInt("ro.config.vc_call_vol_steps",
- MAX_STREAM_VOLUME[AudioSystem.STREAM_VOICE_CALL]);
- if (maxVolume != MAX_STREAM_VOLUME[AudioSystem.STREAM_VOICE_CALL]) {
- MAX_STREAM_VOLUME[AudioSystem.STREAM_VOICE_CALL] = maxVolume;
- AudioSystem.DEFAULT_STREAM_VOLUME[AudioSystem.STREAM_VOICE_CALL] = (maxVolume * 3) / 4;
+ int maxCallVolume = SystemProperties.getInt("ro.config.vc_call_vol_steps", -1);
+ if (maxCallVolume != -1) {
+ MAX_STREAM_VOLUME[AudioSystem.STREAM_VOICE_CALL] = maxCallVolume;
+ AudioSystem.DEFAULT_STREAM_VOLUME[AudioSystem.STREAM_VOICE_CALL] =
+ (maxCallVolume * 3) / 4;
}
- maxVolume = SystemProperties.getInt("ro.config.media_vol_steps",
- MAX_STREAM_VOLUME[AudioSystem.STREAM_MUSIC]);
- if (maxVolume != MAX_STREAM_VOLUME[AudioSystem.STREAM_MUSIC]) {
- MAX_STREAM_VOLUME[AudioSystem.STREAM_MUSIC] = maxVolume;
+
+ int maxMusicVolume = SystemProperties.getInt("ro.config.media_vol_steps", -1);
+ if (maxMusicVolume != -1) {
+ MAX_STREAM_VOLUME[AudioSystem.STREAM_MUSIC] = maxMusicVolume;
+ }
+
+ int defaultMusicVolume = SystemProperties.getInt("ro.config.media_vol_default", -1);
+ if (defaultMusicVolume != -1 &&
+ defaultMusicVolume <= MAX_STREAM_VOLUME[AudioSystem.STREAM_MUSIC]) {
+ AudioSystem.DEFAULT_STREAM_VOLUME[AudioSystem.STREAM_MUSIC] = defaultMusicVolume;
+ } else {
if (isPlatformTelevision()) {
- AudioSystem.DEFAULT_STREAM_VOLUME[AudioSystem.STREAM_MUSIC] = maxVolume / 4;
+ AudioSystem.DEFAULT_STREAM_VOLUME[AudioSystem.STREAM_MUSIC] =
+ MAX_STREAM_VOLUME[AudioSystem.STREAM_MUSIC] / 4;
} else {
- AudioSystem.DEFAULT_STREAM_VOLUME[AudioSystem.STREAM_MUSIC] = (maxVolume * 3) / 4;
+ AudioSystem.DEFAULT_STREAM_VOLUME[AudioSystem.STREAM_MUSIC] =
+ MAX_STREAM_VOLUME[AudioSystem.STREAM_MUSIC] / 3;
}
}
@@ -1018,6 +1027,19 @@
checkAllFixedVolumeDevices();
checkAllAliasStreamVolumes();
checkMuteAffectedStreams();
+ updateDefaultVolumes();
+ }
+
+ // Update default indexes from aliased streams. Must be called after mStreamStates is created
+ private void updateDefaultVolumes() {
+ for (int stream = 0; stream < mStreamStates.length; stream++) {
+ if (stream != mStreamVolumeAlias[stream]) {
+ AudioSystem.DEFAULT_STREAM_VOLUME[stream] = rescaleIndex(
+ AudioSystem.DEFAULT_STREAM_VOLUME[mStreamVolumeAlias[stream]],
+ mStreamVolumeAlias[stream],
+ stream);
+ }
+ }
}
private void dumpStreamStates(PrintWriter pw) {
@@ -1066,7 +1088,9 @@
mStreamVolumeAlias[AudioSystem.STREAM_DTMF] = dtmfStreamAlias;
mStreamVolumeAlias[AudioSystem.STREAM_ACCESSIBILITY] = a11yStreamAlias;
- if (updateVolumes) {
+ if (updateVolumes && mStreamStates != null) {
+ updateDefaultVolumes();
+
mStreamStates[AudioSystem.STREAM_DTMF].setAllIndexes(mStreamStates[dtmfStreamAlias],
caller);
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index 92e8f49..e848f06 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -1975,7 +1975,7 @@
return false;
}
- final boolean windowsAreFocusable = mAppToken != null && mAppToken.windowsAreFocusable();
+ final boolean windowsAreFocusable = mAppToken == null || mAppToken.windowsAreFocusable();
if (!windowsAreFocusable) {
// This window can't be an IME target if the app's windows should not be focusable.
return false;
diff --git a/tools/aapt2/ConfigDescription.cpp b/tools/aapt2/ConfigDescription.cpp
index f16d806..7ff0c72 100644
--- a/tools/aapt2/ConfigDescription.cpp
+++ b/tools/aapt2/ConfigDescription.cpp
@@ -987,8 +987,4 @@
return !ConflictsWith(o) && !Dominates(o) && !o.Dominates(*this);
}
-::std::ostream& operator<<(::std::ostream& out, const ConfigDescription& o) {
- return out << o.toString().string();
-}
-
} // namespace aapt
diff --git a/tools/aapt2/ConfigDescription.h b/tools/aapt2/ConfigDescription.h
index 8c519a1..65c9617 100644
--- a/tools/aapt2/ConfigDescription.h
+++ b/tools/aapt2/ConfigDescription.h
@@ -24,22 +24,30 @@
namespace aapt {
-// Subclass of ResTable_config that adds convenient
-// initialization and comparison methods.
+/*
+ * Subclass of ResTable_config that adds convenient
+ * initialization and comparison methods.
+ */
struct ConfigDescription : public android::ResTable_config {
- // Returns an immutable default config.
+ /**
+ * Returns an immutable default config.
+ */
static const ConfigDescription& DefaultConfig();
- // Parse a string of the form 'fr-sw600dp-land' and fill in the
- // given ResTable_config with resulting configuration parameters.
- //
- // The resulting configuration has the appropriate sdkVersion defined
- // for backwards compatibility.
+ /*
+ * Parse a string of the form 'fr-sw600dp-land' and fill in the
+ * given ResTable_config with resulting configuration parameters.
+ *
+ * The resulting configuration has the appropriate sdkVersion defined
+ * for backwards compatibility.
+ */
static bool Parse(const android::StringPiece& str, ConfigDescription* out = nullptr);
- // If the configuration uses an axis that was added after
- // the original Android release, make sure the SDK version
- // is set accordingly.
+ /**
+ * If the configuration uses an axis that was added after
+ * the original Android release, make sure the SDK version
+ * is set accordingly.
+ */
static void ApplyVersionForCompatibility(ConfigDescription* config);
ConfigDescription();
@@ -53,30 +61,38 @@
ConfigDescription CopyWithoutSdkVersion() const;
- // A configuration X dominates another configuration Y, if X has at least the
- // precedence of Y and X is strictly more general than Y: for any type defined
- // by X, the same type is defined by Y with a value equal to or, in the case
- // of ranges, more specific than that of X.
- //
- // For example, the configuration 'en-w800dp' dominates 'en-rGB-w1024dp'. It
- // does not dominate 'fr', 'en-w720dp', or 'mcc001-en-w800dp'.
+ /**
+ * A configuration X dominates another configuration Y, if X has at least the
+ * precedence of Y and X is strictly more general than Y: for any type defined
+ * by X, the same type is defined by Y with a value equal to or, in the case
+ * of ranges, more specific than that of X.
+ *
+ * For example, the configuration 'en-w800dp' dominates 'en-rGB-w1024dp'. It
+ * does not dominate 'fr', 'en-w720dp', or 'mcc001-en-w800dp'.
+ */
bool Dominates(const ConfigDescription& o) const;
- // Returns true if this configuration defines a more important configuration
- // parameter than o. For example, "en" has higher precedence than "v23",
- // whereas "en" has the same precedence as "en-v23".
+ /**
+ * Returns true if this configuration defines a more important configuration
+ * parameter than o. For example, "en" has higher precedence than "v23",
+ * whereas "en" has the same precedence as "en-v23".
+ */
bool HasHigherPrecedenceThan(const ConfigDescription& o) const;
- // A configuration conflicts with another configuration if both
- // configurations define an incompatible configuration parameter. An
- // incompatible configuration parameter is a non-range, non-density parameter
- // that is defined in both configurations as a different, non-default value.
+ /**
+ * A configuration conflicts with another configuration if both
+ * configurations define an incompatible configuration parameter. An
+ * incompatible configuration parameter is a non-range, non-density parameter
+ * that is defined in both configurations as a different, non-default value.
+ */
bool ConflictsWith(const ConfigDescription& o) const;
- // A configuration is compatible with another configuration if both
- // configurations can match a common concrete device configuration and are
- // unrelated by domination. For example, land-v11 conflicts with port-v21
- // but is compatible with v21 (both land-v11 and v21 would match en-land-v23).
+ /**
+ * A configuration is compatible with another configuration if both
+ * configurations can match a common concrete device configuration and are
+ * unrelated by domination. For example, land-v11 conflicts with port-v21
+ * but is compatible with v21 (both land-v11 and v21 would match en-land-v23).
+ */
bool IsCompatibleWith(const ConfigDescription& o) const;
bool MatchWithDensity(const ConfigDescription& o) const;
@@ -89,8 +105,6 @@
bool operator>(const ConfigDescription& o) const;
};
-::std::ostream& operator<<(::std::ostream& out, const ConfigDescription& o);
-
inline ConfigDescription::ConfigDescription() {
memset(this, 0, sizeof(*this));
size = sizeof(android::ResTable_config);
@@ -109,13 +123,15 @@
*this = o;
}
-inline ConfigDescription& ConfigDescription::operator=(const android::ResTable_config& o) {
+inline ConfigDescription& ConfigDescription::operator=(
+ const android::ResTable_config& o) {
*static_cast<android::ResTable_config*>(this) = o;
size = sizeof(android::ResTable_config);
return *this;
}
-inline ConfigDescription& ConfigDescription::operator=(const ConfigDescription& o) {
+inline ConfigDescription& ConfigDescription::operator=(
+ const ConfigDescription& o) {
*static_cast<android::ResTable_config*>(this) = o;
return *this;
}
@@ -125,7 +141,8 @@
return *this;
}
-inline bool ConfigDescription::MatchWithDensity(const ConfigDescription& o) const {
+inline bool ConfigDescription::MatchWithDensity(
+ const ConfigDescription& o) const {
return match(o) && (density == 0 || density == o.density);
}
@@ -153,6 +170,11 @@
return compare(o) > 0;
}
+inline ::std::ostream& operator<<(::std::ostream& out,
+ const ConfigDescription& o) {
+ return out << o.toString().string();
+}
+
} // namespace aapt
#endif // AAPT_CONFIG_DESCRIPTION_H
diff --git a/tools/aapt2/cmd/Link.cpp b/tools/aapt2/cmd/Link.cpp
index 353d734..e6bf3a6 100644
--- a/tools/aapt2/cmd/Link.cpp
+++ b/tools/aapt2/cmd/Link.cpp
@@ -60,7 +60,6 @@
#include "unflatten/BinaryResourceParser.h"
#include "util/Files.h"
#include "xml/XmlDom.h"
-#include "xml/XmlUtil.h"
using android::StringPiece;
using android::base::StringPrintf;
@@ -343,18 +342,16 @@
ConfigDescription config;
// The entry this file came from.
- ResourceEntry* entry = nullptr;
+ ResourceEntry* entry;
// The file to copy as-is.
- io::IFile* file_to_copy = nullptr;
+ io::IFile* file_to_copy;
// The XML to process and flatten.
std::unique_ptr<xml::XmlResource> xml_to_flatten;
// The destination to write this file to.
std::string dst_path;
-
- bool skip_versioning = false;
};
uint32_t GetCompressionFlags(const StringPiece& str);
@@ -434,6 +431,19 @@
return ArchiveEntry::kCompress;
}
+static bool IsTransitionElement(const std::string& name) {
+ return name == "fade" || name == "changeBounds" || name == "slide" || name == "explode" ||
+ name == "changeImageTransform" || name == "changeTransform" ||
+ name == "changeClipBounds" || name == "autoTransition" || name == "recolor" ||
+ name == "changeScroll" || name == "transitionSet" || name == "transition" ||
+ name == "transitionManager";
+}
+
+static bool IsVectorElement(const std::string& name) {
+ return name == "vector" || name == "animated-vector" || name == "pathInterpolator" ||
+ name == "objectAnimator";
+}
+
template <typename T>
std::vector<T> make_singleton_vec(T&& val) {
std::vector<T> vec;
@@ -466,10 +476,21 @@
}
}
- if (options_.no_auto_version || file_op->skip_versioning) {
+ if (options_.no_auto_version) {
return make_singleton_vec(std::move(file_op->xml_to_flatten));
}
+ if (options_.no_version_vectors || options_.no_version_transitions) {
+ // Skip this if it is a vector or animated-vector.
+ xml::Element* el = xml::FindRootElement(doc);
+ if (el && el->namespace_uri.empty()) {
+ if ((options_.no_version_vectors && IsVectorElement(el->name)) ||
+ (options_.no_version_transitions && IsTransitionElement(el->name))) {
+ return make_singleton_vec(std::move(file_op->xml_to_flatten));
+ }
+ }
+ }
+
const ConfigDescription& config = file_op->config;
ResourceEntry* entry = file_op->entry;
@@ -483,26 +504,15 @@
bool error = false;
std::map<std::pair<ConfigDescription, StringPiece>, FileOperation> config_sorted_files;
- int tag_version_options = 0;
- if (options_.no_version_vectors) {
- tag_version_options |= xml::kNoVersionVector;
- }
-
- if (options_.no_version_transitions) {
- tag_version_options |= xml::kNoVersionTransition;
- }
-
for (auto& pkg : table->packages) {
for (auto& type : pkg->types) {
// Sort by config and name, so that we get better locality in the zip file.
config_sorted_files.clear();
+ std::queue<FileOperation> file_operations;
// Populate the queue with all files in the ResourceTable.
for (auto& entry : type->entries) {
- const auto values_end = entry->values.end();
- for (auto values_iter = entry->values.begin(); values_iter != values_end; ++values_iter) {
- ResourceConfigValue* config_value = values_iter->get();
-
+ for (auto& config_value : entry->values) {
// WARNING! Do not insert or remove any resources while executing in this scope. It will
// corrupt the iteration order.
@@ -544,44 +554,6 @@
file_op.xml_to_flatten->file.config = config_value->config;
file_op.xml_to_flatten->file.source = file_ref->GetSource();
file_op.xml_to_flatten->file.name = ResourceName(pkg->name, type->type, entry->name);
-
- // Check if this file needs to be versioned based on tag rules.
- xml::Element* root_el = xml::FindRootElement(file_op.xml_to_flatten.get());
- if (root_el == nullptr) {
- context_->GetDiagnostics()->Error(DiagMessage(file->GetSource())
- << "failed to find the root XML element");
- return false;
- }
-
- if (root_el->namespace_uri.empty()) {
- if (Maybe<xml::TagApiVersionResult> result =
- xml::GetXmlTagApiVersion(root_el->name, tag_version_options)) {
- file_op.skip_versioning = result.value().skip_version;
- if (result.value().api_version && config_value->config.sdkVersion == 0u) {
- const ApiVersion min_tag_version = result.value().api_version.value();
- // Only version it if it doesn't specify its own version and the version is
- // greater than the minSdk.
- const util::Range<ApiVersion> valid_range{
- context_->GetMinSdkVersion() + 1,
- FindNextApiVersionForConfigInSortedVector(values_iter, values_end)};
- if (valid_range.Contains(min_tag_version)) {
- // Update the configurations. The iteration order will not be affected
- // since sdkVersions in ConfigDescriptions are the last property compared
- // in the sort function.
- if (context_->IsVerbose()) {
- context_->GetDiagnostics()->Note(DiagMessage(config_value->value->GetSource())
- << "auto-versioning XML resource to API "
- << min_tag_version);
- }
- const_cast<ConfigDescription&>(config_value->config).sdkVersion =
- static_cast<uint16_t>(min_tag_version);
- file_op.config.sdkVersion = static_cast<uint16_t>(min_tag_version);
- file_op.xml_to_flatten->file.config.sdkVersion =
- static_cast<uint16_t>(min_tag_version);
- }
- }
- }
- }
}
// NOTE(adamlesinski): Explicitly construct a StringPiece here, or
diff --git a/tools/aapt2/integration-tests/AppOne/res/drawable/adaptive-icon.xml b/tools/aapt2/integration-tests/AppOne/res/drawable/adaptive-icon.xml
deleted file mode 100644
index e3cda7e..0000000
--- a/tools/aapt2/integration-tests/AppOne/res/drawable/adaptive-icon.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2017 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.
--->
-
-<adaptive-icon xmlns:android="http://schema.android.com/apk/res/android">
- <background android:drawable="@android:color/white" />
- <foreground android:drawable="@drawable/image" />
-</adaptive-icon>
diff --git a/tools/aapt2/link/AutoVersioner.cpp b/tools/aapt2/link/AutoVersioner.cpp
index 4ac70d9..f80c6e9 100644
--- a/tools/aapt2/link/AutoVersioner.cpp
+++ b/tools/aapt2/link/AutoVersioner.cpp
@@ -34,19 +34,6 @@
return sdk_version_to_generate < FindNextApiVersionForConfig(entry, config);
}
-ApiVersion FindNextApiVersionForConfigInSortedVector(
- std::vector<std::unique_ptr<ResourceConfigValue>>::const_iterator start,
- std::vector<std::unique_ptr<ResourceConfigValue>>::const_iterator end) {
- const ConfigDescription start_config = (*start)->config.CopyWithoutSdkVersion();
- ++start;
- if (start != end) {
- if ((*start)->config.CopyWithoutSdkVersion() == start_config) {
- return static_cast<ApiVersion>((*start)->config.sdkVersion);
- }
- }
- return std::numeric_limits<ApiVersion>::max();
-}
-
ApiVersion FindNextApiVersionForConfig(const ResourceEntry* entry,
const ConfigDescription& config) {
const auto end_iter = entry->values.end();
@@ -59,7 +46,25 @@
// The source config came from this list, so it should be here.
CHECK(iter != entry->values.end());
- return FindNextApiVersionForConfigInSortedVector(iter, end_iter);
+ ++iter;
+
+ // The next configuration either only varies in sdkVersion, or it is completely different
+ // and therefore incompatible. If it is incompatible, we must generate the versioned resource.
+
+ // NOTE: The ordering of configurations takes sdkVersion as higher precedence than other
+ // qualifiers, so we need to iterate through the entire list to be sure there
+ // are no higher sdk level versions of this resource.
+ ConfigDescription temp_config(config);
+ for (; iter != end_iter; ++iter) {
+ temp_config.sdkVersion = (*iter)->config.sdkVersion;
+ if (temp_config == (*iter)->config) {
+ // The two configs are the same, return the sdkVersion.
+ return (*iter)->config.sdkVersion;
+ }
+ }
+
+ // Didn't find another config with a different sdk version, so return the highest possible value.
+ return std::numeric_limits<ApiVersion>::max();
}
bool AutoVersioner::Consume(IAaptContext* context, ResourceTable* table) {
diff --git a/tools/aapt2/link/AutoVersioner_test.cpp b/tools/aapt2/link/AutoVersioner_test.cpp
index 88a831b..49639f8 100644
--- a/tools/aapt2/link/AutoVersioner_test.cpp
+++ b/tools/aapt2/link/AutoVersioner_test.cpp
@@ -42,8 +42,8 @@
ResourceEntry entry("foo");
entry.values.push_back(util::make_unique<ResourceConfigValue>(ConfigDescription::DefaultConfig(), ""));
- entry.values.push_back(util::make_unique<ResourceConfigValue>(v21_config, ""));
entry.values.push_back(util::make_unique<ResourceConfigValue>(sw600dp_v13_config, ""));
+ entry.values.push_back(util::make_unique<ResourceConfigValue>(v21_config, ""));
EXPECT_TRUE(ShouldGenerateVersionedResource(&entry, ConfigDescription::DefaultConfig(), 17));
EXPECT_FALSE(ShouldGenerateVersionedResource(&entry, ConfigDescription::DefaultConfig(), 22));
diff --git a/tools/aapt2/link/Linkers.h b/tools/aapt2/link/Linkers.h
index 493b6b1..5527f90 100644
--- a/tools/aapt2/link/Linkers.h
+++ b/tools/aapt2/link/Linkers.h
@@ -23,7 +23,6 @@
#include "android-base/macros.h"
#include "Resource.h"
-#include "ResourceTable.h"
#include "SdkConstants.h"
#include "process/IResourceTableConsumer.h"
#include "xml/XmlDom.h"
@@ -42,19 +41,17 @@
ResourceNameRef resource;
};
-// Determines whether a versioned resource should be created. If a versioned resource already
-// exists, it takes precedence.
+/**
+ * Determines whether a versioned resource should be created. If a versioned
+ * resource already exists, it takes precedence.
+ */
bool ShouldGenerateVersionedResource(const ResourceEntry* entry, const ConfigDescription& config,
const ApiVersion sdk_version_to_generate);
-// Finds the next largest ApiVersion of `config` for values defined for `entry`.
+// Finds the next largest ApiVersion of the config which is identical to the given config except
+// for sdkVersion.
ApiVersion FindNextApiVersionForConfig(const ResourceEntry* entry, const ConfigDescription& config);
-// Finds the next largest ApiVersion of the config pointed to by the iterator `start`.
-ApiVersion FindNextApiVersionForConfigInSortedVector(
- std::vector<std::unique_ptr<ResourceConfigValue>>::const_iterator start,
- std::vector<std::unique_ptr<ResourceConfigValue>>::const_iterator end);
-
class AutoVersioner : public IResourceTableConsumer {
public:
AutoVersioner() = default;
diff --git a/tools/aapt2/readme.md b/tools/aapt2/readme.md
index e128c13..c8d3617 100644
--- a/tools/aapt2/readme.md
+++ b/tools/aapt2/readme.md
@@ -9,7 +9,6 @@
(bug 62839863)
- Fixed issue where Java classes referenced from fragments and menus were not added to
the set of Proguard keep rules. (bug 62216174)
-- Automatically version XML `<adaptive-icon>` resources to v26. (bug 62316340)
- Fixed issue where escaped unicode characters would generate malformed UTF-8. (bug 62839202)
- Fixed issue where apostrophes or quotes used in XML attribute values were ignored.
(bug 62840406, 62840718)
diff --git a/tools/aapt2/util/TypeTraits.h b/tools/aapt2/util/TypeTraits.h
index 6fcb4bdb..b6539ed 100644
--- a/tools/aapt2/util/TypeTraits.h
+++ b/tools/aapt2/util/TypeTraits.h
@@ -38,7 +38,6 @@
DEFINE_HAS_BINARY_OP_TRAIT(has_eq_op, ==);
DEFINE_HAS_BINARY_OP_TRAIT(has_lt_op, <);
-DEFINE_HAS_BINARY_OP_TRAIT(has_lte_op, <=);
/**
* Type trait that checks if two types can be equated (==) and compared (<).
diff --git a/tools/aapt2/util/Util.h b/tools/aapt2/util/Util.h
index 410258c..b9ada77 100644
--- a/tools/aapt2/util/Util.h
+++ b/tools/aapt2/util/Util.h
@@ -48,11 +48,6 @@
struct Range {
T start;
T end;
-
- typename std::enable_if<has_lte_op<const T, const T>::value, bool>::type Contains(
- const T& t) const {
- return start <= t && t < end;
- }
};
std::vector<std::string> Split(const android::StringPiece& str, char sep);
diff --git a/tools/aapt2/xml/XmlUtil.cpp b/tools/aapt2/xml/XmlUtil.cpp
index fa1b0f0..fb8cee8 100644
--- a/tools/aapt2/xml/XmlUtil.cpp
+++ b/tools/aapt2/xml/XmlUtil.cpp
@@ -80,65 +80,5 @@
}
}
-namespace {
-
-struct TagCompat {
- ApiVersion api_version;
-
- enum class XmlType {
- kVector,
- kTransition,
- kAdaptiveIcon,
- };
-
- XmlType type;
-};
-
-std::unordered_map<StringPiece, TagCompat> sTagVersions = {
- {"fade", {SDK_LOLLIPOP, TagCompat::XmlType::kTransition}},
- {"changeBounds", {SDK_LOLLIPOP, TagCompat::XmlType::kTransition}},
- {"slide", {SDK_LOLLIPOP, TagCompat::XmlType::kTransition}},
- {"explode", {SDK_LOLLIPOP, TagCompat::XmlType::kTransition}},
- {"changeImageTransform", {SDK_LOLLIPOP, TagCompat::XmlType::kTransition}},
- {"changeTransform", {SDK_LOLLIPOP, TagCompat::XmlType::kTransition}},
- {"changeClipBounds", {SDK_LOLLIPOP, TagCompat::XmlType::kTransition}},
- {"autoTransition", {SDK_LOLLIPOP, TagCompat::XmlType::kTransition}},
- {"recolor", {SDK_LOLLIPOP, TagCompat::XmlType::kTransition}},
- {"changeScroll", {SDK_LOLLIPOP, TagCompat::XmlType::kTransition}},
- {"transitionSet", {SDK_LOLLIPOP, TagCompat::XmlType::kTransition}},
- {"transition", {SDK_LOLLIPOP, TagCompat::XmlType::kTransition}},
- {"transitionManager", {SDK_LOLLIPOP, TagCompat::XmlType::kTransition}},
-
- {"vector", {SDK_LOLLIPOP, TagCompat::XmlType::kVector}},
- {"animated-vector", {SDK_LOLLIPOP, TagCompat::XmlType::kVector}},
- {"pathInterpolator", {SDK_LOLLIPOP, TagCompat::XmlType::kVector}},
- {"objectAnimator", {SDK_LOLLIPOP, TagCompat::XmlType::kVector}},
-
- {"adaptive-icon", {SDK_O, TagCompat::XmlType::kAdaptiveIcon}},
-};
-
-} // namespace
-
-Maybe<TagApiVersionResult> GetXmlTagApiVersion(const StringPiece& tag_name, int options) {
- auto iter = sTagVersions.find(tag_name);
- if (iter == sTagVersions.end()) {
- return {};
- }
-
- const TagCompat& tag_compat = iter->second;
- if (options & kNoVersionVector) {
- if (tag_compat.type == TagCompat::XmlType::kVector) {
- return TagApiVersionResult{{}, true /*skip_version*/};
- }
- }
-
- if (options & kNoVersionTransition) {
- if (tag_compat.type == TagCompat::XmlType::kTransition) {
- return TagApiVersionResult{{}, true /*skip_version*/};
- }
- }
- return TagApiVersionResult{tag_compat.api_version, false /*skip_version*/};
-}
-
} // namespace xml
} // namespace aapt
diff --git a/tools/aapt2/xml/XmlUtil.h b/tools/aapt2/xml/XmlUtil.h
index 552f42a..1650ac2 100644
--- a/tools/aapt2/xml/XmlUtil.h
+++ b/tools/aapt2/xml/XmlUtil.h
@@ -20,16 +20,18 @@
#include <string>
#include "ResourceValues.h"
-#include "SdkConstants.h"
#include "util/Maybe.h"
namespace aapt {
namespace xml {
constexpr const char* kSchemaAuto = "http://schemas.android.com/apk/res-auto";
-constexpr const char* kSchemaPublicPrefix = "http://schemas.android.com/apk/res/";
-constexpr const char* kSchemaPrivatePrefix = "http://schemas.android.com/apk/prv/res/";
-constexpr const char* kSchemaAndroid = "http://schemas.android.com/apk/res/android";
+constexpr const char* kSchemaPublicPrefix =
+ "http://schemas.android.com/apk/res/";
+constexpr const char* kSchemaPrivatePrefix =
+ "http://schemas.android.com/apk/prv/res/";
+constexpr const char* kSchemaAndroid =
+ "http://schemas.android.com/apk/res/android";
constexpr const char* kSchemaTools = "http://schemas.android.com/tools";
constexpr const char* kSchemaAapt = "http://schemas.android.com/aapt";
@@ -100,24 +102,6 @@
void TransformReferenceFromNamespace(IPackageDeclStack* decl_stack,
const android::StringPiece& local_package, Reference* in_ref);
-struct TagApiVersionResult {
- // If set, the API version to apply.
- Maybe<ApiVersion> api_version;
-
- // Whether to skip any auto-versioning.
- bool skip_version;
-};
-
-enum TagVersionOptions : int {
- // Skip versioning XML resources that deal with vector drawables.
- kNoVersionVector,
-
- // Skip versioning XML resources that deal with transitions.
- kNoVersionTransition,
-};
-
-Maybe<TagApiVersionResult> GetXmlTagApiVersion(const android::StringPiece& tag_name, int options);
-
} // namespace xml
} // namespace aapt
diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java
index 4ae2c01..7173775 100644
--- a/wifi/java/android/net/wifi/WifiManager.java
+++ b/wifi/java/android/net/wifi/WifiManager.java
@@ -1411,6 +1411,8 @@
public static final int WIFI_FEATURE_IE_WHITELIST = 0x1000000; // Probe IE white listing
/** @hide */
public static final int WIFI_FEATURE_SCAN_RAND = 0x2000000; // Random MAC & Probe seq
+ /** @hide */
+ public static final int WIFI_FEATURE_TX_POWER_LIMIT = 0x4000000; // Set Tx power limit
private int getSupportedFeatures() {