diff options
| author | Steve Kondik <steve@cyngn.com> | 2016-03-10 19:23:13 -0800 |
|---|---|---|
| committer | Steve Kondik <steve@cyngn.com> | 2016-03-10 19:23:13 -0800 |
| commit | 98e06d73262bc654d546ef2ded2cd6c4db5b92bf (patch) | |
| tree | d923c571c21849bf53185b26e3570fdb25fabff9 /v4/api23 | |
| parent | 6f0a2cb4415e2e170528c038a8f1cc2f68f60c3c (diff) | |
| parent | 4097efdd93078034122f17442d5b4df675d1028a (diff) | |
| download | android_frameworks_support-98e06d73262bc654d546ef2ded2cd6c4db5b92bf.tar.gz android_frameworks_support-98e06d73262bc654d546ef2ded2cd6c4db5b92bf.tar.bz2 android_frameworks_support-98e06d73262bc654d546ef2ded2cd6c4db5b92bf.zip | |
Merge tag 'android-6.0.1_r22' of https://android.googlesource.com/platform/frameworks/support into cm-13.0staging/cm-13.0+r22
Android 6.0.1 release 22
Change-Id: I032842dcd2a5a216a56a47a7cb109f0cee8ac251
Diffstat (limited to 'v4/api23')
7 files changed, 238 insertions, 2 deletions
diff --git a/v4/api23/android/support/v4/app/AppOpsManagerCompat23.java b/v4/api23/android/support/v4/app/AppOpsManagerCompat23.java index 64a1206949..72e07bf0ed 100644 --- a/v4/api23/android/support/v4/app/AppOpsManagerCompat23.java +++ b/v4/api23/android/support/v4/app/AppOpsManagerCompat23.java @@ -22,7 +22,7 @@ import android.content.Context; /** * AppOpsManager implementations for API 23. */ -public class AppOpsManagerCompat23 { +class AppOpsManagerCompat23 { public static String permissionToOp(String permission) { return AppOpsManager.permissionToOp(permission); } diff --git a/v4/api23/android/support/v4/content/ResourcesCompatApi23.java b/v4/api23/android/support/v4/content/ResourcesCompatApi23.java new file mode 100644 index 0000000000..c44f9cef1f --- /dev/null +++ b/v4/api23/android/support/v4/content/ResourcesCompatApi23.java @@ -0,0 +1,33 @@ +/* + * 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. + */ + +package android.support.v4.content.res; + +import android.content.res.ColorStateList; +import android.content.res.Resources; +import android.content.res.Resources.NotFoundException; +import android.content.res.Resources.Theme; + +class ResourcesCompatApi23 { + public static int getColor(Resources res, int id, Theme theme) throws NotFoundException { + return res.getColor(id, theme); + } + + public static ColorStateList getColorStateList(Resources res, int id, Theme theme) + throws NotFoundException { + return res.getColorStateList(id, theme); + } +} diff --git a/v4/api23/android/support/v4/media/MediaBrowserCompatApi23.java b/v4/api23/android/support/v4/media/MediaBrowserCompatApi23.java new file mode 100644 index 0000000000..1e9df1a439 --- /dev/null +++ b/v4/api23/android/support/v4/media/MediaBrowserCompatApi23.java @@ -0,0 +1,57 @@ +/* + * 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. + */ + +package android.support.v4.media; + +import android.media.browse.MediaBrowser; +import android.os.Parcel; +import android.support.annotation.NonNull; + +class MediaBrowserCompatApi23 { + + public static Object createItemCallback(ItemCallback callback) { + return new ItemCallbackProxy<>(callback); + } + + public static void getItem(Object browserObj, String mediaId, Object itemCallbackObj) { + ((MediaBrowser) browserObj).getItem(mediaId, ((MediaBrowser.ItemCallback) itemCallbackObj)); + } + + interface ItemCallback { + void onItemLoaded(Parcel itemParcel); + void onError(@NonNull String itemId); + } + + static class ItemCallbackProxy<T extends ItemCallback> extends MediaBrowser.ItemCallback { + protected final T mItemCallback; + + public ItemCallbackProxy(T callback) { + mItemCallback = callback; + } + + @Override + public void onItemLoaded(MediaBrowser.MediaItem item) { + Parcel parcel = Parcel.obtain(); + item.writeToParcel(parcel, 0); + mItemCallback.onItemLoaded(parcel); + } + + @Override + public void onError(@NonNull String itemId) { + mItemCallback.onError(itemId); + } + } +} diff --git a/v4/api23/android/support/v4/media/MediaBrowserServiceCompatApi23.java b/v4/api23/android/support/v4/media/MediaBrowserServiceCompatApi23.java new file mode 100644 index 0000000000..fcaea408a2 --- /dev/null +++ b/v4/api23/android/support/v4/media/MediaBrowserServiceCompatApi23.java @@ -0,0 +1,86 @@ +/* + * 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. + */ + +package android.support.v4.media; + +import android.media.browse.MediaBrowser; +import android.os.Bundle; +import android.os.Parcel; +import android.os.ResultReceiver; +import android.service.media.MediaBrowserService; +import android.util.Log; + +class MediaBrowserServiceCompatApi23 extends MediaBrowserServiceCompatApi21 { + private static final String TAG = "MediaBrowserServiceCompatApi21"; + + public static Object createService() { + return new MediaBrowserServiceAdaptorApi23(); + } + + public static void onCreate(Object serviceObj, ServiceImplApi23 serviceImpl) { + ((MediaBrowserServiceAdaptorApi23) serviceObj).onCreate(serviceImpl); + } + + public interface ServiceImplApi23 extends ServiceImplApi21 { + void getMediaItem(final String mediaId, final ItemCallback cb); + } + + public interface ItemCallback { + void onItemLoaded(int resultCode, Bundle resultData, Parcel itemParcel); + } + + static class MediaBrowserServiceAdaptorApi23 extends MediaBrowserServiceAdaptorApi21 { + + public void onCreate(ServiceImplApi23 serviceImpl) { + mBinder = new ServiceBinderProxyApi23(serviceImpl); + } + + private static class ServiceBinderProxyApi23 extends ServiceBinderProxyApi21 { + ServiceImplApi23 mServiceImpl; + + ServiceBinderProxyApi23(ServiceImplApi23 serviceImpl) { + super(serviceImpl); + mServiceImpl = serviceImpl; + } + + @Override + public void getMediaItem(final String mediaId, final ResultReceiver receiver) { + final String KEY_MEDIA_ITEM; + try { + KEY_MEDIA_ITEM = (String) MediaBrowserService.class.getDeclaredField( + "KEY_MEDIA_ITEM").get(null); + } catch (IllegalAccessException | NoSuchFieldException e) { + Log.i(TAG, "Failed to get KEY_MEDIA_ITEM via reflection", e); + return; + } + + mServiceImpl.getMediaItem(mediaId, new ItemCallback() { + @Override + public void onItemLoaded(int resultCode, Bundle resultData, Parcel itemParcel) { + if (itemParcel != null) { + itemParcel.setDataPosition(0); + MediaBrowser.MediaItem item = + MediaBrowser.MediaItem.CREATOR.createFromParcel(itemParcel); + resultData.putParcelable(KEY_MEDIA_ITEM, item); + itemParcel.recycle(); + } + receiver.send(resultCode, resultData); + } + }); + } + } + } +} diff --git a/v4/api23/android/support/v4/text/ICUCompatApi23.java b/v4/api23/android/support/v4/text/ICUCompatApi23.java index f013522a90..1a3c54f17e 100644 --- a/v4/api23/android/support/v4/text/ICUCompatApi23.java +++ b/v4/api23/android/support/v4/text/ICUCompatApi23.java @@ -22,7 +22,7 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Locale; -public class ICUCompatApi23 { +class ICUCompatApi23 { private static final String TAG = "ICUCompatIcs"; diff --git a/v4/api23/android/support/v4/view/ViewCompatMarshmallow.java b/v4/api23/android/support/v4/view/ViewCompatMarshmallow.java new file mode 100644 index 0000000000..16d3ae88e1 --- /dev/null +++ b/v4/api23/android/support/v4/view/ViewCompatMarshmallow.java @@ -0,0 +1,33 @@ +/* + * 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. + */ + +package android.support.v4.view; + +import android.view.View; + +class ViewCompatMarshmallow { + public static void setScrollIndicators(View view, int indicators) { + view.setScrollIndicators(indicators); + } + + public static void setScrollIndicators(View view, int indicators, int mask) { + view.setScrollIndicators(indicators, mask); + } + + public static int getScrollIndicators(View view) { + return view.getScrollIndicators(); + } +} diff --git a/v4/api23/android/support/v4/widget/TextViewCompatApi23.java b/v4/api23/android/support/v4/widget/TextViewCompatApi23.java new file mode 100644 index 0000000000..8370bfcd87 --- /dev/null +++ b/v4/api23/android/support/v4/widget/TextViewCompatApi23.java @@ -0,0 +1,27 @@ +/* + * 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. + */ + +package android.support.v4.widget; + +import android.support.annotation.IdRes; +import android.support.annotation.NonNull; +import android.widget.TextView; + +class TextViewCompatApi23 { + public static void setTextAppearance(@NonNull TextView textView, @IdRes int resId) { + textView.setTextAppearance(resId); + } +} |
