1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Android: Remove unnecessary SDK version checks

This commit is contained in:
reuk 2025-03-17 14:53:10 +00:00
parent 80b190b75d
commit 51be8b9332
No known key found for this signature in database
15 changed files with 210 additions and 405 deletions

View file

@ -150,8 +150,8 @@ struct AndroidDocumentDetail
return LocalRef<jobject>{};
LocalRef<jstring> documentId { (jstring) env->CallObjectMethod (cursor, AndroidCursor.getString, idColumnIndex) };
return LocalRef<jobject> { getEnv()->CallStaticObjectMethod (DocumentsContract21,
DocumentsContract21.buildDocumentUriUsingTree,
return LocalRef<jobject> { getEnv()->CallStaticObjectMethod (DocumentsContract,
DocumentsContract.buildDocumentUriUsingTree,
treeUri.get(),
documentId.get()) };
}();
@ -164,11 +164,11 @@ struct AndroidDocumentDetail
static DocumentsContractIteratorEngine makeDocumentsContractIteratorEngine (const GlobalRef& uri)
{
const LocalRef <jobject> documentId { getEnv()->CallStaticObjectMethod (DocumentsContract19,
DocumentsContract19.getDocumentId,
const LocalRef <jobject> documentId { getEnv()->CallStaticObjectMethod (DocumentsContract,
DocumentsContract.getDocumentId,
uri.get()) };
const LocalRef <jobject> childrenUri { getEnv()->CallStaticObjectMethod (DocumentsContract21,
DocumentsContract21.buildChildDocumentsUriUsingTree,
const LocalRef <jobject> childrenUri { getEnv()->CallStaticObjectMethod (DocumentsContract,
DocumentsContract.buildChildDocumentsUriUsingTree,
uri.get(),
documentId.get()) };
@ -329,34 +329,10 @@ public:
virtual AndroidDocumentInfo getInfo() const = 0;
virtual URL getUrl() const = 0;
virtual NativeInfo getNativeInfo() const = 0;
virtual std::unique_ptr<Pimpl> copyDocumentToParentDocument (const Pimpl&) const
{
// This function is not supported on the current platform.
jassertfalse;
return {};
}
virtual std::unique_ptr<Pimpl> moveDocumentFromParentToParent (const Pimpl&, const Pimpl&) const
{
// This function is not supported on the current platform.
jassertfalse;
return {};
}
virtual std::unique_ptr<Pimpl> renameTo (const String&) const
{
// This function is not supported on the current platform.
jassertfalse;
return {};
}
virtual std::unique_ptr<Pimpl> createChildDocumentWithTypeAndName (const String&, const String&) const
{
// This function is not supported on the current platform.
jassertfalse;
return {};
}
virtual std::unique_ptr<Pimpl> copyDocumentToParentDocument (const Pimpl&) const = 0;
virtual std::unique_ptr<Pimpl> moveDocumentFromParentToParent (const Pimpl&, const Pimpl&) const = 0;
virtual std::unique_ptr<Pimpl> renameTo (const String&) const = 0;
virtual std::unique_ptr<Pimpl> createChildDocumentWithTypeAndName (const String&, const String&) const = 0;
File getFile() const { return getUrl().getLocalFile(); }
@ -398,23 +374,23 @@ struct AndroidDocument::Utils
};
//==============================================================================
class AndroidDocumentPimplApi21 : public Pimpl
class AndroidDocumentPimpl : public Pimpl
{
public:
AndroidDocumentPimplApi21() = default;
AndroidDocumentPimpl() = default;
explicit AndroidDocumentPimplApi21 (const URL& uriIn)
: AndroidDocumentPimplApi21 (urlToUri (uriIn)) {}
explicit AndroidDocumentPimpl (const URL& uriIn)
: AndroidDocumentPimpl (urlToUri (uriIn)) {}
explicit AndroidDocumentPimplApi21 (const LocalRef<jobject>& uriIn)
explicit AndroidDocumentPimpl (const LocalRef<jobject>& uriIn)
: uri (uriIn) {}
bool deleteDocument() const override
{
if (const auto resolver = AndroidContentUriResolver::getContentResolver())
{
return getEnv()->CallStaticBooleanMethod (DocumentsContract19,
DocumentsContract19.deleteDocument,
return getEnv()->CallStaticBooleanMethod (DocumentsContract,
DocumentsContract.deleteDocument,
resolver.get(),
uri.get());
}
@ -517,12 +493,10 @@ struct AndroidDocument::Utils
NativeInfo getNativeInfo() const override { return { uri }; }
std::unique_ptr<Pimpl> clone() const override { return std::make_unique<AndroidDocumentPimplApi21> (*this); }
std::unique_ptr<Pimpl> createChildDocumentWithTypeAndName (const String& type, const String& name) const override
{
return Utils::createPimplForSdk (LocalRef<jobject> { getEnv()->CallStaticObjectMethod (DocumentsContract21,
DocumentsContract21.createDocument,
return Utils::createPimplForSdk (LocalRef<jobject> { getEnv()->CallStaticObjectMethod (DocumentsContract,
DocumentsContract.createDocument,
AndroidContentUriResolver::getContentResolver().get(),
getNativeInfo().uri.get(),
javaString (type).get(),
@ -533,8 +507,8 @@ struct AndroidDocument::Utils
{
if (const auto resolver = AndroidContentUriResolver::getContentResolver())
{
return Utils::createPimplForSdk (LocalRef<jobject> { getEnv()->CallStaticObjectMethod (DocumentsContract21,
DocumentsContract21.renameDocument,
return Utils::createPimplForSdk (LocalRef<jobject> { getEnv()->CallStaticObjectMethod (DocumentsContract,
DocumentsContract.renameDocument,
resolver.get(),
getNativeInfo().uri.get(),
javaString (name).get()) });
@ -543,17 +517,7 @@ struct AndroidDocument::Utils
return nullptr;
}
private:
GlobalRef uri;
};
//==============================================================================
class AndroidDocumentPimplApi24 final : public AndroidDocumentPimplApi21
{
public:
using AndroidDocumentPimplApi21::AndroidDocumentPimplApi21;
std::unique_ptr<Pimpl> clone() const override { return std::make_unique<AndroidDocumentPimplApi24> (*this); }
std::unique_ptr<Pimpl> clone() const override { return std::make_unique<AndroidDocumentPimpl> (*this); }
std::unique_ptr<Pimpl> copyDocumentToParentDocument (const Pimpl& target) const override
{
@ -563,8 +527,8 @@ struct AndroidDocument::Utils
return {};
}
return Utils::createPimplForSdk (LocalRef<jobject> { getEnv()->CallStaticObjectMethod (DocumentsContract24,
DocumentsContract24.copyDocument,
return Utils::createPimplForSdk (LocalRef<jobject> { getEnv()->CallStaticObjectMethod (DocumentsContract,
DocumentsContract.copyDocument,
AndroidContentUriResolver::getContentResolver().get(),
getNativeInfo().uri.get(),
target.getNativeInfo().uri.get()) });
@ -578,41 +542,25 @@ struct AndroidDocument::Utils
return {};
}
return Utils::createPimplForSdk (LocalRef<jobject> { getEnv()->CallStaticObjectMethod (DocumentsContract24,
DocumentsContract24.moveDocument,
return Utils::createPimplForSdk (LocalRef<jobject> { getEnv()->CallStaticObjectMethod (DocumentsContract,
DocumentsContract.moveDocument,
AndroidContentUriResolver::getContentResolver().get(),
getNativeInfo().uri.get(),
currentParent.getNativeInfo().uri.get(),
newParent.getNativeInfo().uri.get()) });
}
private:
GlobalRef uri;
};
//==============================================================================
static std::unique_ptr<Pimpl> createPimplForSdk (const LocalRef<jobject>& uri)
{
if (jniCheckHasExceptionOccurredAndClear())
return nullptr;
return createPimplForSdkImpl (uri,
VersionTag<AndroidDocumentPimplApi24> { 24 },
VersionTag<AndroidDocumentPimplApi21> { 21 });
}
static std::unique_ptr<Pimpl> createPimplForSdkImpl (const LocalRef<jobject>&)
{
// Failed to find a suitable implementation for this platform
jassertfalse;
return nullptr;
}
template <typename T, typename... Ts>
static std::unique_ptr<Pimpl> createPimplForSdkImpl (const LocalRef<jobject>& uri,
VersionTag<T> head,
VersionTag<Ts>... tail)
{
if (head.version <= getAndroidSDKVersion())
return std::make_unique<T> (uri);
return createPimplForSdkImpl (uri, tail...);
return std::make_unique<AndroidDocumentPimpl> (uri);
}
#else
@ -747,14 +695,14 @@ struct AndroidDocument::Utils
void AndroidDocumentPermission::takePersistentReadWriteAccess ([[maybe_unused]] const URL& url)
{
#if JUCE_ANDROID
AndroidDocumentDetail::setPermissions (url, ContentResolver19.takePersistableUriPermission);
AndroidDocumentDetail::setPermissions (url, ContentResolver.takePersistableUriPermission);
#endif
}
void AndroidDocumentPermission::releasePersistentReadWriteAccess ([[maybe_unused]] const URL& url)
{
#if JUCE_ANDROID
AndroidDocumentDetail::setPermissions (url, ContentResolver19.releasePersistableUriPermission);
AndroidDocumentDetail::setPermissions (url, ContentResolver.releasePersistableUriPermission);
#endif
}
@ -765,7 +713,7 @@ std::vector<AndroidDocumentPermission> AndroidDocumentPermission::getPersistedPe
#else
auto* env = getEnv();
const LocalRef<jobject> permissions { env->CallObjectMethod (AndroidContentUriResolver::getContentResolver().get(),
ContentResolver19.getPersistedUriPermissions) };
ContentResolver.getPersistedUriPermissions) };
if (permissions == nullptr)
return {};
@ -814,8 +762,8 @@ AndroidDocument AndroidDocument::fromDocument ([[maybe_unused]] const URL& docum
#if JUCE_ANDROID
const auto javaUri = urlToUri (documentUrl);
if (! getEnv()->CallStaticBooleanMethod (DocumentsContract19,
DocumentsContract19.isDocumentUri,
if (! getEnv()->CallStaticBooleanMethod (DocumentsContract,
DocumentsContract.isDocumentUri,
getAppContext().get(),
javaUri.get()))
{
@ -832,8 +780,8 @@ AndroidDocument AndroidDocument::fromTree ([[maybe_unused]] const URL& treeUrl)
{
#if JUCE_ANDROID
const auto javaUri = urlToUri (treeUrl);
LocalRef<jobject> treeDocumentId { getEnv()->CallStaticObjectMethod (DocumentsContract21,
DocumentsContract21.getTreeDocumentId,
LocalRef<jobject> treeDocumentId { getEnv()->CallStaticObjectMethod (DocumentsContract,
DocumentsContract.getTreeDocumentId,
javaUri.get()) };
jniCheckHasExceptionOccurredAndClear();
@ -844,8 +792,8 @@ AndroidDocument AndroidDocument::fromTree ([[maybe_unused]] const URL& treeUrl)
return AndroidDocument{};
}
LocalRef<jobject> documentUri { getEnv()->CallStaticObjectMethod (DocumentsContract21,
DocumentsContract21.buildDocumentUriUsingTree,
LocalRef<jobject> documentUri { getEnv()->CallStaticObjectMethod (DocumentsContract,
DocumentsContract.buildDocumentUriUsingTree,
javaUri.get(),
treeDocumentId.get()) };
@ -1010,14 +958,6 @@ AndroidDocumentIterator AndroidDocumentIterator::makeNonRecursive (const Android
using Detail = AndroidDocumentDetail;
#if JUCE_ANDROID
if (getAndroidSDKVersion() == 21)
{
if (auto uri = dir.getNativeInfo().uri)
return Utils::makeWithEngine (Detail::makeDocumentsContractIteratorEngine (uri));
}
#endif
return Utils::makeWithEngineInplace<Detail::DirectoryIteratorEngine> (dir.getUrl().getLocalFile(), false);
}
@ -1028,14 +968,6 @@ AndroidDocumentIterator AndroidDocumentIterator::makeRecursive (const AndroidDoc
using Detail = AndroidDocumentDetail;
#if JUCE_ANDROID
if (getAndroidSDKVersion() == 21)
{
if (auto uri = dir.getNativeInfo().uri)
return Utils::makeWithEngine (Detail::RecursiveEngine { uri });
}
#endif
return Utils::makeWithEngineInplace<Detail::DirectoryIteratorEngine> (dir.getUrl().getLocalFile(), true);
}

View file

@ -47,17 +47,12 @@ DECLARE_JNI_CLASS (MediaScannerConnection, "android/media/MediaScannerConnection
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
METHOD (query, "query", "(Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)Landroid/database/Cursor;") \
METHOD (openInputStream, "openInputStream", "(Landroid/net/Uri;)Ljava/io/InputStream;") \
METHOD (openOutputStream, "openOutputStream", "(Landroid/net/Uri;)Ljava/io/OutputStream;")
DECLARE_JNI_CLASS (ContentResolver, "android/content/ContentResolver")
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
METHOD (openOutputStream, "openOutputStream", "(Landroid/net/Uri;)Ljava/io/OutputStream;") \
METHOD (takePersistableUriPermission, "takePersistableUriPermission", "(Landroid/net/Uri;I)V") \
METHOD (releasePersistableUriPermission, "releasePersistableUriPermission", "(Landroid/net/Uri;I)V") \
METHOD (getPersistedUriPermissions, "getPersistedUriPermissions", "()Ljava/util/List;")
DECLARE_JNI_CLASS_WITH_MIN_SDK (ContentResolver19, "android/content/ContentResolver", 19)
DECLARE_JNI_CLASS (ContentResolver, "android/content/ContentResolver")
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
@ -105,6 +100,7 @@ DECLARE_JNI_CLASS (AndroidInputStream, "java/io/InputStream")
DECLARE_JNI_CLASS (AndroidApplicationInfo, "android/content/pm/ApplicationInfo")
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
STATICMETHOD (buildChildDocumentsUri, "buildChildDocumentsUri", "(Ljava/lang/String;Ljava/lang/String;)Landroid/net/Uri;") \
STATICMETHOD (buildDocumentUri, "buildDocumentUri", "(Ljava/lang/String;Ljava/lang/String;)Landroid/net/Uri;") \
@ -115,28 +111,18 @@ DECLARE_JNI_CLASS (AndroidApplicationInfo, "android/content/pm/ApplicationInfo")
STATICMETHOD (deleteDocument, "deleteDocument", "(Landroid/content/ContentResolver;Landroid/net/Uri;)Z") \
STATICMETHOD (getDocumentId, "getDocumentId", "(Landroid/net/Uri;)Ljava/lang/String;") \
STATICMETHOD (getRootId, "getRootId", "(Landroid/net/Uri;)Ljava/lang/String;") \
STATICMETHOD (isDocumentUri, "isDocumentUri", "(Landroid/content/Context;Landroid/net/Uri;)Z")
DECLARE_JNI_CLASS_WITH_MIN_SDK (DocumentsContract19, "android/provider/DocumentsContract", 19)
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
STATICMETHOD (isDocumentUri, "isDocumentUri", "(Landroid/content/Context;Landroid/net/Uri;)Z") \
STATICMETHOD (buildChildDocumentsUriUsingTree, "buildChildDocumentsUriUsingTree", "(Landroid/net/Uri;Ljava/lang/String;)Landroid/net/Uri;") \
STATICMETHOD (buildDocumentUriUsingTree, "buildDocumentUriUsingTree", "(Landroid/net/Uri;Ljava/lang/String;)Landroid/net/Uri;") \
STATICMETHOD (buildTreeDocumentUri, "buildTreeDocumentUri", "(Ljava/lang/String;Ljava/lang/String;)Landroid/net/Uri;") \
STATICMETHOD (createDocument, "createDocument", "(Landroid/content/ContentResolver;Landroid/net/Uri;Ljava/lang/String;Ljava/lang/String;)Landroid/net/Uri;") \
STATICMETHOD (getTreeDocumentId, "getTreeDocumentId", "(Landroid/net/Uri;)Ljava/lang/String;") \
STATICMETHOD (renameDocument, "renameDocument", "(Landroid/content/ContentResolver;Landroid/net/Uri;Ljava/lang/String;)Landroid/net/Uri;")
DECLARE_JNI_CLASS_WITH_MIN_SDK (DocumentsContract21, "android/provider/DocumentsContract", 21)
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
STATICMETHOD (renameDocument, "renameDocument", "(Landroid/content/ContentResolver;Landroid/net/Uri;Ljava/lang/String;)Landroid/net/Uri;") \
STATICMETHOD (copyDocument, "copyDocument", "(Landroid/content/ContentResolver;Landroid/net/Uri;Landroid/net/Uri;)Landroid/net/Uri;") \
STATICMETHOD (moveDocument, "moveDocument", "(Landroid/content/ContentResolver;Landroid/net/Uri;Landroid/net/Uri;Landroid/net/Uri;)Landroid/net/Uri;") \
STATICMETHOD (removeDocument, "removeDocument", "(Landroid/content/ContentResolver;Landroid/net/Uri;Landroid/net/Uri;)Z")
DECLARE_JNI_CLASS_WITH_MIN_SDK (DocumentsContract24, "android/provider/DocumentsContract", 24)
DECLARE_JNI_CLASS (DocumentsContract, "android/provider/DocumentsContract")
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
@ -153,7 +139,7 @@ DECLARE_JNI_CLASS (AndroidMimeTypeMap, "android/webkit/MimeTypeMap")
METHOD (isReadPermission, "isReadPermission", "()Z") \
METHOD (isWritePermission, "isWritePermission", "()Z")
DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidUriPermission, "android/content/UriPermission", 19)
DECLARE_JNI_CLASS (AndroidUriPermission, "android/content/UriPermission")
#undef JNI_CLASS_MEMBERS
//==============================================================================

View file

@ -312,11 +312,12 @@ template <typename T, size_t N> constexpr auto numBytes (const T (&) [N]) { retu
//==============================================================================
#define DECLARE_JNI_CLASS_WITH_MIN_SDK(CppClassName, javaPath, minSDK) \
static_assert (minSDK >= 24, "There's no need to supply a min SDK lower than JUCE's minimum requirement"); \
DECLARE_JNI_CLASS_WITH_BYTECODE (CppClassName, javaPath, minSDK, nullptr)
//==============================================================================
#define DECLARE_JNI_CLASS(CppClassName, javaPath) \
DECLARE_JNI_CLASS_WITH_MIN_SDK (CppClassName, javaPath, 16)
DECLARE_JNI_CLASS_WITH_MIN_SDK (CppClassName, javaPath, 24)
//==============================================================================
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
@ -359,7 +360,7 @@ DECLARE_JNI_CLASS (AndroidActivity, "android/app/Activity")
METHOD (startActivityForResult, "startActivityForResult", "(Landroid/content/Intent;I)V") \
METHOD (setArguments, "setArguments", "(Landroid/os/Bundle;)V")
DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidFragment, "android/app/Fragment", 11)
DECLARE_JNI_CLASS (AndroidFragment, "android/app/Fragment")
#undef JNI_CLASS_MEMBERS
//==============================================================================
@ -369,7 +370,7 @@ DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidFragment, "android/app/Fragment", 11)
METHOD (setContentType, "setContentType", "(I)Landroid/media/AudioAttributes$Builder;") \
METHOD (setUsage, "setUsage", "(I)Landroid/media/AudioAttributes$Builder;")
DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidAudioAttributesBuilder, "android/media/AudioAttributes$Builder", 21)
DECLARE_JNI_CLASS (AndroidAudioAttributesBuilder, "android/media/AudioAttributes$Builder")
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
@ -472,6 +473,7 @@ DECLARE_JNI_CLASS (AndroidHandlerThread, "android/os/HandlerThread")
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
STATICMETHOD (createChooser, "createChooser", "(Landroid/content/Intent;Ljava/lang/CharSequence;)Landroid/content/Intent;") \
STATICMETHOD (createChooserWithSender, "createChooser", "(Landroid/content/Intent;Ljava/lang/CharSequence;Landroid/content/IntentSender;)Landroid/content/Intent;") \
METHOD (addCategory, "addCategory", "(Ljava/lang/String;)Landroid/content/Intent;") \
METHOD (constructor, "<init>", "()V") \
METHOD (constructorWithContextAndClass, "<init>", "(Landroid/content/Context;Ljava/lang/Class;)V") \
@ -500,12 +502,6 @@ DECLARE_JNI_CLASS (AndroidHandlerThread, "android/os/HandlerThread")
DECLARE_JNI_CLASS (AndroidIntent, "android/content/Intent")
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
STATICMETHOD (createChooser, "createChooser", "(Landroid/content/Intent;Ljava/lang/CharSequence;Landroid/content/IntentSender;)Landroid/content/Intent;") \
DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidIntent22, "android/content/Intent", 22)
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
METHOD (constructor, "<init>", "()V") \
METHOD (postRotate, "postRotate", "(FFF)Z") \
@ -578,7 +574,7 @@ DECLARE_JNI_CLASS (AndroidPendingIntent, "android/app/PendingIntent")
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
METHOD (toString, "toString", "()Ljava/lang/String;")
DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidRange, "android/util/Range", 21)
DECLARE_JNI_CLASS (AndroidRange, "android/util/Range")
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
@ -617,7 +613,7 @@ DECLARE_JNI_CLASS (AndroidConfiguration, "android/content/res/Configuration")
METHOD (getHeight, "getHeight", "()I") \
METHOD (getWidth, "getWidth", "()I")
DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidSize, "android/util/Size", 21)
DECLARE_JNI_CLASS (AndroidSize, "android/util/Size")
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
@ -647,15 +643,10 @@ DECLARE_JNI_CLASS (AndroidUri, "android/net/Uri")
METHOD (getRootView, "getRootView", "()Landroid/view/View;") \
METHOD (addOnLayoutChangeListener, "addOnLayoutChangeListener", "(Landroid/view/View$OnLayoutChangeListener;)V") \
METHOD (announceForAccessibility, "announceForAccessibility", "(Ljava/lang/CharSequence;)V") \
DECLARE_JNI_CLASS (AndroidView, "android/view/View")
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
METHOD (setOnApplyWindowInsetsListener, "setOnApplyWindowInsetsListener", "(Landroid/view/View$OnApplyWindowInsetsListener;)V") \
METHOD (getRootWindowInsets, "getRootWindowInsets", "()Landroid/view/WindowInsets;")
DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidView23, "android/view/View", 23)
DECLARE_JNI_CLASS (AndroidView, "android/view/View")
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \

View file

@ -247,7 +247,7 @@ void RuntimePermissions::request (PermissionID permission, Callback callback)
auto alreadyGranted = isGranted (permission);
if (alreadyGranted || getAndroidSDKVersion() < 23)
if (alreadyGranted)
{
callback (alreadyGranted);
return;
@ -276,7 +276,7 @@ void RuntimePermissions::request (PermissionID permission, Callback callback)
bool RuntimePermissions::isRequired (PermissionID /*permission*/)
{
return getAndroidSDKVersion() >= 23;
return true;
}
bool RuntimePermissions::isGranted (PermissionID permission)