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

@ -207,8 +207,7 @@ public:
STREAM_MUSIC, sampleRate, CHANNEL_OUT_STEREO, ENCODING_PCM_16BIT,
(jint) (minBufferSizeOut * numDeviceOutputChannels * static_cast<int> (sizeof (int16))), MODE_STREAM)));
const bool supportsUnderrunCount = (getAndroidSDKVersion() >= 24);
getUnderrunCount = supportsUnderrunCount ? env->GetMethodID (AudioTrack, "getUnderrunCount", "()I") : nullptr;
getUnderrunCount = env->GetMethodID (AudioTrack, "getUnderrunCount", "()I");
int outputDeviceState = env->CallIntMethod (outputDevice, AudioTrack.getState);
if (outputDeviceState > 0)

View file

@ -798,7 +798,7 @@ constexpr unsigned char javaMidiByteCode[]
METHOD (openMidiInputPortWithID, "openMidiInputPortWithID", "(IJ)Lcom/rmsl/juce/JuceMidiSupport$JuceMidiPort;") \
METHOD (openMidiOutputPortWithID, "openMidiOutputPortWithID", "(I)Lcom/rmsl/juce/JuceMidiSupport$JuceMidiPort;")
DECLARE_JNI_CLASS_WITH_MIN_SDK (MidiDeviceManager, "com/rmsl/juce/JuceMidiSupport$MidiDeviceManager", 23)
DECLARE_JNI_CLASS (MidiDeviceManager, "com/rmsl/juce/JuceMidiSupport$MidiDeviceManager")
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
@ -808,7 +808,7 @@ DECLARE_JNI_CLASS_WITH_MIN_SDK (MidiDeviceManager, "com/rmsl/juce/JuceMidiSuppor
METHOD (sendMidi, "sendMidi", "([BII)V") \
METHOD (getName, "getName", "()Ljava/lang/String;")
DECLARE_JNI_CLASS_WITH_MIN_SDK (JuceMidiPort, "com/rmsl/juce/JuceMidiSupport$JuceMidiPort", 23)
DECLARE_JNI_CLASS (JuceMidiPort, "com/rmsl/juce/JuceMidiSupport$JuceMidiPort")
#undef JNI_CLASS_MEMBERS
//==============================================================================
@ -928,7 +928,7 @@ private:
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
CALLBACK (generatedCallback<&MidiInput::Pimpl::handleReceive>, "handleReceive", "(J[BIIJ)V" )
DECLARE_JNI_CLASS_WITH_MIN_SDK (JuceMidiInputPort, "com/rmsl/juce/JuceMidiSupport$JuceMidiInputPort", 23)
DECLARE_JNI_CLASS (JuceMidiInputPort, "com/rmsl/juce/JuceMidiSupport$JuceMidiInputPort")
#undef JNI_CLASS_MEMBERS
//==============================================================================
@ -1014,24 +1014,18 @@ private:
//==============================================================================
Array<MidiDeviceInfo> MidiInput::getAvailableDevices()
{
if (getAndroidSDKVersion() < 23)
return {};
AndroidMidiDeviceManager manager;
return manager.getDevices (true);
}
MidiDeviceInfo MidiInput::getDefaultDevice()
{
if (getAndroidSDKVersion() < 23)
return {};
return getAvailableDevices().getFirst();
}
std::unique_ptr<MidiInput> MidiInput::openDevice (const String& deviceIdentifier, MidiInputCallback* callback)
{
if (getAndroidSDKVersion() < 23 || deviceIdentifier.isEmpty())
if (deviceIdentifier.isEmpty())
return {};
AndroidMidiDeviceManager manager;
@ -1051,9 +1045,6 @@ std::unique_ptr<MidiInput> MidiInput::openDevice (const String& deviceIdentifier
StringArray MidiInput::getDevices()
{
if (getAndroidSDKVersion() < 23)
return {};
StringArray deviceNames;
for (auto& d : getAvailableDevices())
@ -1064,7 +1055,7 @@ StringArray MidiInput::getDevices()
int MidiInput::getDefaultDeviceIndex()
{
return (getAndroidSDKVersion() < 23 ? -1 : 0);
return 0;
}
std::unique_ptr<MidiInput> MidiInput::openDevice (int index, MidiInputCallback* callback)
@ -1094,24 +1085,18 @@ void MidiInput::stop()
//==============================================================================
Array<MidiDeviceInfo> MidiOutput::getAvailableDevices()
{
if (getAndroidSDKVersion() < 23)
return {};
AndroidMidiDeviceManager manager;
return manager.getDevices (false);
}
MidiDeviceInfo MidiOutput::getDefaultDevice()
{
if (getAndroidSDKVersion() < 23)
return {};
return getAvailableDevices().getFirst();
}
std::unique_ptr<MidiOutput> MidiOutput::openDevice (const String& deviceIdentifier)
{
if (getAndroidSDKVersion() < 23 || deviceIdentifier.isEmpty())
if (deviceIdentifier.isEmpty())
return {};
AndroidMidiDeviceManager manager;
@ -1130,9 +1115,6 @@ std::unique_ptr<MidiOutput> MidiOutput::openDevice (const String& deviceIdentifi
StringArray MidiOutput::getDevices()
{
if (getAndroidSDKVersion() < 23)
return {};
StringArray deviceNames;
for (auto& d : getAvailableDevices())
@ -1143,7 +1125,7 @@ StringArray MidiOutput::getDevices()
int MidiOutput::getDefaultDeviceIndex()
{
return (getAndroidSDKVersion() < 23 ? -1 : 0);
return 0;
}
std::unique_ptr<MidiOutput> MidiOutput::openDevice (int index)

View file

@ -1196,8 +1196,7 @@ public:
bool supportsDevicesInfo() const
{
static auto result = getAndroidSDKVersion() >= 23;
return result;
return true;
}
void addDevice (const LocalRef<jobject>& device, JNIEnv* env)

View file

@ -360,22 +360,17 @@ public:
if (runner == nullptr)
return false;
const bool supportsJavaProxy = (getAndroidSDKVersion() >= 24);
// may return nullptr on some platforms - that's ok
config = SlRef<SLAndroidConfigurationItf_>::cast (runner);
if (supportsJavaProxy)
if (config != nullptr)
{
// may return nullptr on some platforms - that's ok
config = SlRef<SLAndroidConfigurationItf_>::cast (runner);
jobject audioRoutingJni;
auto status = (*config)->AcquireJavaProxy (config, /*SL_ANDROID_JAVA_PROXY_ROUTING*/1,
&audioRoutingJni);
if (config != nullptr)
{
jobject audioRoutingJni;
auto status = (*config)->AcquireJavaProxy (config, /*SL_ANDROID_JAVA_PROXY_ROUTING*/1,
&audioRoutingJni);
if (status == SL_RESULT_SUCCESS && audioRoutingJni != nullptr)
javaProxy = GlobalRef (LocalRef<jobject> (getEnv()->NewLocalRef (audioRoutingJni)));
}
if (status == SL_RESULT_SUCCESS && audioRoutingJni != nullptr)
javaProxy = GlobalRef (LocalRef<jobject> (getEnv()->NewLocalRef (audioRoutingJni)));
}
queue = SlRef<SLAndroidSimpleBufferQueueItf_>::cast (runner);
@ -677,8 +672,7 @@ public:
return;
}
const bool supportsUnderrunCount = (getAndroidSDKVersion() >= 24);
getUnderrunCount = supportsUnderrunCount ? getEnv()->GetMethodID (AudioTrack, "getUnderrunCount", "()I") : nullptr;
getUnderrunCount = getEnv()->GetMethodID (AudioTrack, "getUnderrunCount", "()I");
}
}
}
@ -1054,18 +1048,14 @@ OpenSLAudioIODevice::OpenSLSession* OpenSLAudioIODevice::OpenSLSession::create (
int numBuffersToUse)
{
std::unique_ptr<OpenSLSession> retval;
auto sdkVersion = getAndroidSDKVersion();
// SDK versions 21 and higher should natively support floating point...
if (sdkVersion >= 21)
{
retval.reset (new OpenSLSessionT<float> (numInputChannels, numOutputChannels, samleRateToUse,
bufferSizeToUse, numBuffersToUse));
retval.reset (new OpenSLSessionT<float> (numInputChannels, numOutputChannels, samleRateToUse,
bufferSizeToUse, numBuffersToUse));
// ...however, some devices lie so re-try without floating point
if (retval != nullptr && (! retval->openedOK()))
retval = nullptr;
}
// ...however, some devices lie so re-try without floating point
if (retval != nullptr && (! retval->openedOK()))
retval = nullptr;
if (retval == nullptr)
{

View file

@ -38,7 +38,7 @@ namespace juce
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
STATICMETHOD (getAndroidBluetoothManager, "getAndroidBluetoothManager", "(Landroid/content/Context;)Lcom/rmsl/juce/JuceMidiSupport$BluetoothMidiManager;")
DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidJuceMidiSupport, "com/rmsl/juce/JuceMidiSupport", 23)
DECLARE_JNI_CLASS (AndroidJuceMidiSupport, "com/rmsl/juce/JuceMidiSupport")
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
@ -49,7 +49,7 @@ DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidJuceMidiSupport, "com/rmsl/juce/JuceMidiS
METHOD (getBluetoothDeviceStatus, "getBluetoothDeviceStatus", "(Ljava/lang/String;)I") \
METHOD (startStopScan, "startStopScan", "(Z)V")
DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidBluetoothManager, "com/rmsl/juce/JuceMidiSupport$BluetoothMidiManager", 23)
DECLARE_JNI_CLASS (AndroidBluetoothManager, "com/rmsl/juce/JuceMidiSupport$BluetoothMidiManager")
#undef JNI_CLASS_MEMBERS
//==============================================================================
@ -501,9 +501,6 @@ bool BluetoothMidiDevicePairingDialogue::open (ModalComponentManager::Callback*
{
std::unique_ptr<ModalComponentManager::Callback> exitCallback (exitCallbackPtr);
if (getAndroidSDKVersion() < 23)
return false;
auto boundsToUse = (btBounds != nullptr ? *btBounds : Rectangle<int> {});
if (! RuntimePermissions::isGranted (RuntimePermissions::bluetoothMidi))
@ -521,9 +518,6 @@ bool BluetoothMidiDevicePairingDialogue::open (ModalComponentManager::Callback*
bool BluetoothMidiDevicePairingDialogue::isAvailable()
{
if (getAndroidSDKVersion() < 23)
return false;
auto* env = getEnv();
LocalRef<jobject> btManager (env->CallStaticObjectMethod (AndroidJuceMidiSupport, AndroidJuceMidiSupport.getAndroidBluetoothManager, getAppContext().get()));

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)

View file

@ -60,27 +60,22 @@ namespace juce
METHOD (setText, "setText", "(Ljava/lang/CharSequence;)V") \
METHOD (setMovementGranularities, "setMovementGranularities", "(I)V") \
METHOD (addAction, "addAction", "(I)V") \
METHOD (setCollectionInfo, "setCollectionInfo", "(Landroid/view/accessibility/AccessibilityNodeInfo$CollectionInfo;)V") \
METHOD (setCollectionItemInfo, "setCollectionItemInfo", "(Landroid/view/accessibility/AccessibilityNodeInfo$CollectionItemInfo;)V")
DECLARE_JNI_CLASS (AndroidAccessibilityNodeInfo, "android/view/accessibility/AccessibilityNodeInfo")
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
METHOD (setCollectionInfo, "setCollectionInfo", "(Landroid/view/accessibility/AccessibilityNodeInfo$CollectionInfo;)V") \
METHOD (setCollectionItemInfo, "setCollectionItemInfo", "(Landroid/view/accessibility/AccessibilityNodeInfo$CollectionItemInfo;)V")
DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidAccessibilityNodeInfo19, "android/view/accessibility/AccessibilityNodeInfo", 19)
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
STATICMETHOD (obtain, "obtain", "(IIZ)Landroid/view/accessibility/AccessibilityNodeInfo$CollectionInfo;")
DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidAccessibilityNodeInfoCollectionInfo, "android/view/accessibility/AccessibilityNodeInfo$CollectionInfo", 19)
DECLARE_JNI_CLASS (AndroidAccessibilityNodeInfoCollectionInfo, "android/view/accessibility/AccessibilityNodeInfo$CollectionInfo")
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
STATICMETHOD (obtain, "obtain", "(IIIIZ)Landroid/view/accessibility/AccessibilityNodeInfo$CollectionItemInfo;")
DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidAccessibilityNodeInfoCollectionItemInfo, "android/view/accessibility/AccessibilityNodeInfo$CollectionItemInfo", 19)
DECLARE_JNI_CLASS (AndroidAccessibilityNodeInfoCollectionItemInfo, "android/view/accessibility/AccessibilityNodeInfo$CollectionItemInfo")
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
@ -500,7 +495,7 @@ public:
(jint) rows,
(jint) columns,
(jboolean) false) };
env->CallVoidMethod (info, AndroidAccessibilityNodeInfo19.setCollectionInfo, collectionInfo.get());
env->CallVoidMethod (info, AndroidAccessibilityNodeInfo.setCollectionInfo, collectionInfo.get());
}
if (auto* enclosingTableHandler = detail::AccessibilityHelpers::getEnclosingHandlerWithInterface (&accessibilityHandler, &AccessibilityHandler::getTableInterface))
@ -521,7 +516,7 @@ public:
(jint) columns.begin,
(jint) columns.num,
(jboolean) (header == IsHeader::yes)) };
env->CallVoidMethod (info, AndroidAccessibilityNodeInfo19.setCollectionItemInfo, collectionItemInfo.get());
env->CallVoidMethod (info, AndroidAccessibilityNodeInfo.setCollectionItemInfo, collectionItemInfo.get());
};
if (rowSpan.hasValue() && columnSpan.hasValue())

View file

@ -370,12 +370,6 @@ private:
const auto text = javaString ("Choose share target");
if (getAndroidSDKVersion() < 22)
return LocalRef<jobject> (env->CallStaticObjectMethod (AndroidIntent,
AndroidIntent.createChooser,
intent.get(),
text.get()));
constexpr jint FLAG_UPDATE_CURRENT = 0x08000000;
constexpr jint FLAG_IMMUTABLE = 0x04000000;
@ -385,7 +379,7 @@ private:
const LocalRef<jobject> replyIntent (env->NewObject (AndroidIntent, AndroidIntent.constructorWithContextAndClass, context.get(), klass));
getEnv()->CallObjectMethod (replyIntent, AndroidIntent.putExtraInt, javaString ("com.rmsl.juce.JUCE_REQUEST_CODE").get(), request);
const auto flags = FLAG_UPDATE_CURRENT | (getAndroidSDKVersion() <= 23 ? 0 : FLAG_IMMUTABLE);
const auto flags = FLAG_UPDATE_CURRENT | FLAG_IMMUTABLE;
const LocalRef<jobject> pendingIntent (env->CallStaticObjectMethod (AndroidPendingIntent,
AndroidPendingIntent.getBroadcast,
context.get(),
@ -393,8 +387,8 @@ private:
replyIntent.get(),
flags));
return LocalRef<jobject> (env->CallStaticObjectMethod (AndroidIntent22,
AndroidIntent22.createChooser,
return LocalRef<jobject> (env->CallStaticObjectMethod (AndroidIntent,
AndroidIntent.createChooserWithSender,
intent.get(),
text.get(),
env->CallObjectMethod (pendingIntent,

View file

@ -1316,7 +1316,7 @@ public:
if (supportsDisplayCutout())
{
if (const auto methodID = AndroidView23.setOnApplyWindowInsetsListener)
if (const auto methodID = AndroidView.setOnApplyWindowInsetsListener)
{
env->CallVoidMethod (view,
methodID,
@ -2700,7 +2700,7 @@ void Displays::findDisplays (float masterScale)
if (! activityArea.isEmpty())
d.userArea = activityArea / d.scale;
if (const auto getRootWindowInsetsMethodId = AndroidView23.getRootWindowInsets)
if (const auto getRootWindowInsetsMethodId = AndroidView.getRootWindowInsets)
{
LocalRef<jobject> insets (env->CallObjectMethod (contentView.get(), getRootWindowInsetsMethodId));
JuceInsets::tie (d) = getInsetsFromAndroidWindowInsets (insets, d.scale).tie();

View file

@ -63,7 +63,7 @@ DECLARE_JNI_CLASS_WITH_MIN_SDK (NotificationChannelGroup, "android/app/Notificat
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
FIELD (extras, "extras", "Landroid/os/Bundle;")
DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidNotification, "android/app/Notification", 19)
DECLARE_JNI_CLASS (AndroidNotification, "android/app/Notification")
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
@ -72,74 +72,48 @@ DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidNotification, "android/app/Notification",
METHOD (constructor, "<init>", "(ILjava/lang/CharSequence;Landroid/app/PendingIntent;)V") \
METHOD (build, "build", "()Landroid/app/Notification$Action;")
DECLARE_JNI_CLASS_WITH_MIN_SDK (NotificationActionBuilder, "android/app/Notification$Action$Builder", 20)
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
METHOD (getNotification, "getNotification", "()Landroid/app/Notification;") \
METHOD (setAutoCancel, "setAutoCancel", "(Z)Landroid/app/Notification$Builder;") \
METHOD (setContentInfo, "setContentInfo", "(Ljava/lang/CharSequence;)Landroid/app/Notification$Builder;") \
METHOD (setContentIntent, "setContentIntent", "(Landroid/app/PendingIntent;)Landroid/app/Notification$Builder;") \
METHOD (setContentText, "setContentText", "(Ljava/lang/CharSequence;)Landroid/app/Notification$Builder;") \
METHOD (setContentTitle, "setContentTitle", "(Ljava/lang/CharSequence;)Landroid/app/Notification$Builder;") \
METHOD (setDefaults, "setDefaults", "(I)Landroid/app/Notification$Builder;") \
METHOD (setDeleteIntent, "setDeleteIntent", "(Landroid/app/PendingIntent;)Landroid/app/Notification$Builder;") \
METHOD (setLargeIcon, "setLargeIcon", "(Landroid/graphics/Bitmap;)Landroid/app/Notification$Builder;") \
METHOD (setLights, "setLights", "(III)Landroid/app/Notification$Builder;") \
METHOD (setNumber, "setNumber", "(I)Landroid/app/Notification$Builder;") \
METHOD (setOngoing, "setOngoing", "(Z)Landroid/app/Notification$Builder;") \
METHOD (setOnlyAlertOnce, "setOnlyAlertOnce", "(Z)Landroid/app/Notification$Builder;") \
METHOD (setProgress, "setProgress", "(IIZ)Landroid/app/Notification$Builder;") \
METHOD (setSmallIcon, "setSmallIcon", "(I)Landroid/app/Notification$Builder;") \
METHOD (setSound, "setSound", "(Landroid/net/Uri;)Landroid/app/Notification$Builder;") \
METHOD (setTicker, "setTicker", "(Ljava/lang/CharSequence;)Landroid/app/Notification$Builder;") \
METHOD (setVibrate, "setVibrate", "([J)Landroid/app/Notification$Builder;") \
METHOD (setWhen, "setWhen", "(J)Landroid/app/Notification$Builder;")
DECLARE_JNI_CLASS_WITH_MIN_SDK (NotificationBuilderBase, "android/app/Notification$Builder", 11)
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
METHOD (addAction, "addAction", "(ILjava/lang/CharSequence;Landroid/app/PendingIntent;)Landroid/app/Notification$Builder;") \
METHOD (build, "build", "()Landroid/app/Notification;") \
METHOD (setPriority, "setPriority", "(I)Landroid/app/Notification$Builder;") \
METHOD (setSubText, "setSubText", "(Ljava/lang/CharSequence;)Landroid/app/Notification$Builder;") \
METHOD (setUsesChronometer, "setUsesChronometer", "(Z)Landroid/app/Notification$Builder;")
DECLARE_JNI_CLASS_WITH_MIN_SDK (NotificationBuilderApi16, "android/app/Notification$Builder", 16)
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
METHOD (setShowWhen, "setShowWhen", "(Z)Landroid/app/Notification$Builder;")
DECLARE_JNI_CLASS_WITH_MIN_SDK (NotificationBuilderApi17, "android/app/Notification$Builder", 17)
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
METHOD (addAction, "addAction", "(Landroid/app/Notification$Action;)Landroid/app/Notification$Builder;") \
METHOD (addExtras, "addExtras", "(Landroid/os/Bundle;)Landroid/app/Notification$Builder;") \
METHOD (setLocalOnly, "setLocalOnly", "(Z)Landroid/app/Notification$Builder;") \
METHOD (setGroup, "setGroup", "(Ljava/lang/String;)Landroid/app/Notification$Builder;") \
METHOD (setGroupSummary, "setGroupSummary", "(Z)Landroid/app/Notification$Builder;") \
METHOD (setSortKey, "setSortKey", "(Ljava/lang/String;)Landroid/app/Notification$Builder;")
DECLARE_JNI_CLASS_WITH_MIN_SDK (NotificationBuilderApi20, "android/app/Notification$Builder", 20)
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
METHOD (addPerson, "addPerson", "(Ljava/lang/String;)Landroid/app/Notification$Builder;") \
METHOD (setCategory, "setCategory", "(Ljava/lang/String;)Landroid/app/Notification$Builder;") \
METHOD (setColor, "setColor", "(I)Landroid/app/Notification$Builder;") \
METHOD (setPublicVersion, "setPublicVersion", "(Landroid/app/Notification;)Landroid/app/Notification$Builder;") \
METHOD (setVisibility, "setVisibility", "(I)Landroid/app/Notification$Builder;")
DECLARE_JNI_CLASS_WITH_MIN_SDK (NotificationBuilderApi21, "android/app/Notification$Builder", 21)
DECLARE_JNI_CLASS (NotificationActionBuilder, "android/app/Notification$Action$Builder")
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
METHOD (getNotification, "getNotification", "()Landroid/app/Notification;") \
METHOD (setAutoCancel, "setAutoCancel", "(Z)Landroid/app/Notification$Builder;") \
METHOD (setContentInfo, "setContentInfo", "(Ljava/lang/CharSequence;)Landroid/app/Notification$Builder;") \
METHOD (setContentIntent, "setContentIntent", "(Landroid/app/PendingIntent;)Landroid/app/Notification$Builder;") \
METHOD (setContentText, "setContentText", "(Ljava/lang/CharSequence;)Landroid/app/Notification$Builder;") \
METHOD (setContentTitle, "setContentTitle", "(Ljava/lang/CharSequence;)Landroid/app/Notification$Builder;") \
METHOD (setDefaults, "setDefaults", "(I)Landroid/app/Notification$Builder;") \
METHOD (setDeleteIntent, "setDeleteIntent", "(Landroid/app/PendingIntent;)Landroid/app/Notification$Builder;") \
METHOD (setLargeIcon, "setLargeIcon", "(Landroid/graphics/Bitmap;)Landroid/app/Notification$Builder;") \
METHOD (setLights, "setLights", "(III)Landroid/app/Notification$Builder;") \
METHOD (setNumber, "setNumber", "(I)Landroid/app/Notification$Builder;") \
METHOD (setOngoing, "setOngoing", "(Z)Landroid/app/Notification$Builder;") \
METHOD (setOnlyAlertOnce, "setOnlyAlertOnce", "(Z)Landroid/app/Notification$Builder;") \
METHOD (setProgress, "setProgress", "(IIZ)Landroid/app/Notification$Builder;") \
METHOD (setSmallIcon, "setSmallIcon", "(I)Landroid/app/Notification$Builder;") \
METHOD (setSound, "setSound", "(Landroid/net/Uri;)Landroid/app/Notification$Builder;") \
METHOD (setTicker, "setTicker", "(Ljava/lang/CharSequence;)Landroid/app/Notification$Builder;") \
METHOD (setVibrate, "setVibrate", "([J)Landroid/app/Notification$Builder;") \
METHOD (setWhen, "setWhen", "(J)Landroid/app/Notification$Builder;") \
METHOD (build, "build", "()Landroid/app/Notification;") \
METHOD (setPriority, "setPriority", "(I)Landroid/app/Notification$Builder;") \
METHOD (setSubText, "setSubText", "(Ljava/lang/CharSequence;)Landroid/app/Notification$Builder;") \
METHOD (setUsesChronometer, "setUsesChronometer", "(Z)Landroid/app/Notification$Builder;") \
METHOD (setShowWhen, "setShowWhen", "(Z)Landroid/app/Notification$Builder;") \
METHOD (addAction, "addAction", "(Landroid/app/Notification$Action;)Landroid/app/Notification$Builder;") \
METHOD (addExtras, "addExtras", "(Landroid/os/Bundle;)Landroid/app/Notification$Builder;") \
METHOD (setLocalOnly, "setLocalOnly", "(Z)Landroid/app/Notification$Builder;") \
METHOD (setGroup, "setGroup", "(Ljava/lang/String;)Landroid/app/Notification$Builder;") \
METHOD (setGroupSummary, "setGroupSummary", "(Z)Landroid/app/Notification$Builder;") \
METHOD (setSortKey, "setSortKey", "(Ljava/lang/String;)Landroid/app/Notification$Builder;") \
METHOD (addPerson, "addPerson", "(Ljava/lang/String;)Landroid/app/Notification$Builder;") \
METHOD (setCategory, "setCategory", "(Ljava/lang/String;)Landroid/app/Notification$Builder;") \
METHOD (setColor, "setColor", "(I)Landroid/app/Notification$Builder;") \
METHOD (setPublicVersion, "setPublicVersion", "(Landroid/app/Notification;)Landroid/app/Notification$Builder;") \
METHOD (setVisibility, "setVisibility", "(I)Landroid/app/Notification$Builder;") \
METHOD (setChronometerCountDown, "setChronometerCountDown", "(Z)Landroid/app/Notification$Builder;")
DECLARE_JNI_CLASS_WITH_MIN_SDK (NotificationBuilderApi24, "android/app/Notification$Builder", 24)
DECLARE_JNI_CLASS (NotificationBuilderBase, "android/app/Notification$Builder")
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
@ -153,21 +127,11 @@ DECLARE_JNI_CLASS_WITH_MIN_SDK (NotificationBuilderApi26, "android/app/Notificat
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
METHOD (cancel, "cancel", "(Ljava/lang/String;I)V") \
METHOD (cancelAll, "cancelAll", "()V") \
METHOD (notify, "notify", "(Ljava/lang/String;ILandroid/app/Notification;)V")
DECLARE_JNI_CLASS (NotificationManagerBase, "android/app/NotificationManager")
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
METHOD (getActiveNotifications, "getActiveNotifications", "()[Landroid/service/notification/StatusBarNotification;")
DECLARE_JNI_CLASS_WITH_MIN_SDK (NotificationManagerApi23, "android/app/NotificationManager", 23)
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
METHOD (notify, "notify", "(Ljava/lang/String;ILandroid/app/Notification;)V") \
METHOD (getActiveNotifications, "getActiveNotifications", "()[Landroid/service/notification/StatusBarNotification;") \
METHOD (areNotificationsEnabled, "areNotificationsEnabled", "()Z")
DECLARE_JNI_CLASS_WITH_MIN_SDK (NotificationManagerApi24, "android/app/NotificationManager", 24)
DECLARE_JNI_CLASS (NotificationManagerBase, "android/app/NotificationManager")
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
@ -180,7 +144,7 @@ DECLARE_JNI_CLASS_WITH_MIN_SDK (NotificationManagerApi26, "android/app/Notificat
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
STATICMETHOD (getResultsFromIntent, "getResultsFromIntent", "(Landroid/content/Intent;)Landroid/os/Bundle;")
DECLARE_JNI_CLASS_WITH_MIN_SDK (RemoteInput, "android/app/RemoteInput", 20)
DECLARE_JNI_CLASS (RemoteInput, "android/app/RemoteInput")
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
@ -190,13 +154,13 @@ DECLARE_JNI_CLASS_WITH_MIN_SDK (RemoteInput, "android/app/RemoteInput", 20)
METHOD (setChoices, "setChoices", "([Ljava/lang/CharSequence;)Landroid/app/RemoteInput$Builder;") \
METHOD (setLabel, "setLabel", "(Ljava/lang/CharSequence;)Landroid/app/RemoteInput$Builder;")
DECLARE_JNI_CLASS_WITH_MIN_SDK (RemoteInputBuilder, "android/app/RemoteInput$Builder", 20)
DECLARE_JNI_CLASS (RemoteInputBuilder, "android/app/RemoteInput$Builder")
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
METHOD (getNotification, "getNotification", "()Landroid/app/Notification;")
DECLARE_JNI_CLASS_WITH_MIN_SDK (StatusBarNotification, "android/service/notification/StatusBarNotification", 23)
DECLARE_JNI_CLASS (StatusBarNotification, "android/service/notification/StatusBarNotification")
#undef JNI_CLASS_MEMBERS
//==============================================================================
@ -287,15 +251,12 @@ struct PushNotifications::Impl
if (getAndroidSDKVersion() >= 33 && ! RuntimePermissions::isGranted (RuntimePermissions::postNotification))
return false;
if (getAndroidSDKVersion() >= 24)
{
auto* env = getEnv();
auto* env = getEnv();
auto notificationManager = getNotificationManager();
auto notificationManager = getNotificationManager();
if (notificationManager.get() != nullptr)
return env->CallBooleanMethod (notificationManager, NotificationManagerApi24.areNotificationsEnabled);
}
if (notificationManager.get() != nullptr)
return env->CallBooleanMethod (notificationManager, NotificationManagerBase.areNotificationsEnabled);
return true;
}
@ -347,39 +308,30 @@ struct PushNotifications::Impl
void getDeliveredNotifications() const
{
if (getAndroidSDKVersion() >= 23)
auto* env = getEnv();
Array<Notification> notifications;
auto notificationManager = getNotificationManager();
jassert (notificationManager != nullptr);
if (notificationManager.get() != nullptr)
{
auto* env = getEnv();
auto statusBarNotifications = LocalRef<jobjectArray> ((jobjectArray)env->CallObjectMethod (notificationManager,
NotificationManagerBase.getActiveNotifications));
Array<Notification> notifications;
const int numNotifications = env->GetArrayLength (statusBarNotifications.get());
auto notificationManager = getNotificationManager();
jassert (notificationManager != nullptr);
if (notificationManager.get() != nullptr)
for (int i = 0; i < numNotifications; ++i)
{
auto statusBarNotifications = LocalRef<jobjectArray> ((jobjectArray)env->CallObjectMethod (notificationManager,
NotificationManagerApi23.getActiveNotifications));
auto statusBarNotification = LocalRef<jobject> (env->GetObjectArrayElement (statusBarNotifications.get(), (jsize) i));
auto notification = LocalRef<jobject> (env->CallObjectMethod (statusBarNotification, StatusBarNotification.getNotification));
const int numNotifications = env->GetArrayLength (statusBarNotifications.get());
for (int i = 0; i < numNotifications; ++i)
{
auto statusBarNotification = LocalRef<jobject> (env->GetObjectArrayElement (statusBarNotifications.get(), (jsize) i));
auto notification = LocalRef<jobject> (env->CallObjectMethod (statusBarNotification, StatusBarNotification.getNotification));
notifications.add (javaNotificationToJuceNotification (notification));
}
notifications.add (javaNotificationToJuceNotification (notification));
}
}
owner.listeners.call ([&] (Listener& l) { l.deliveredNotificationsListReceived (notifications); });
}
else
{
// Not supported on this platform
jassertfalse;
owner.listeners.call ([] (Listener& l) { l.deliveredNotificationsListReceived ({}); });
}
owner.listeners.call ([&] (Listener& l) { l.deliveredNotificationsListReceived (notifications); });
}
void notifyListenersAboutLocalNotification (const LocalRef<jobject>& intent)
@ -643,7 +595,7 @@ struct PushNotifications::Impl
if (notificationBuilder == nullptr)
return notificationBuilder;
return LocalRef<jobject> (env->CallObjectMethod (notificationBuilder, NotificationBuilderApi16.build));
return LocalRef<jobject> (env->CallObjectMethod (notificationBuilder, NotificationBuilderBase.build));
}
static LocalRef<jobject> createNotificationBuilder (const Notification& n)
@ -737,8 +689,8 @@ struct PushNotifications::Impl
if (publicNotificationBuilder == nullptr)
return {};
auto publicVersion = LocalRef<jobject> (env->CallObjectMethod (publicNotificationBuilder, NotificationBuilderApi16.build));
env->CallObjectMethod (notificationBuilder, NotificationBuilderApi21.setPublicVersion, publicVersion.get());
auto publicVersion = LocalRef<jobject> (env->CallObjectMethod (publicNotificationBuilder, NotificationBuilderBase.build));
env->CallObjectMethod (notificationBuilder, NotificationBuilderBase.setPublicVersion, publicVersion.get());
}
return notificationBuilder;
@ -863,57 +815,48 @@ struct PushNotifications::Impl
env->CallObjectMethod (notificationBuilder, NotificationBuilderBase.setOnlyAlertOnce, n.alertOnlyOnce);
if (n.subtitle.isNotEmpty())
env->CallObjectMethod (notificationBuilder, NotificationBuilderApi16.setSubText, javaString (n.subtitle).get());
env->CallObjectMethod (notificationBuilder, NotificationBuilderBase.setSubText, javaString (n.subtitle).get());
env->CallObjectMethod (notificationBuilder, NotificationBuilderApi16.setPriority, n.priority);
if (getAndroidSDKVersion() < 24)
{
const bool useChronometer = n.timestampVisibility == Notification::chronometer;
env->CallObjectMethod (notificationBuilder, NotificationBuilderApi16.setUsesChronometer, useChronometer);
}
env->CallObjectMethod (notificationBuilder, NotificationBuilderBase.setPriority, n.priority);
const bool showTimeStamp = n.timestampVisibility != Notification::off;
env->CallObjectMethod (notificationBuilder, NotificationBuilderApi17.setShowWhen, showTimeStamp);
env->CallObjectMethod (notificationBuilder, NotificationBuilderBase.setShowWhen, showTimeStamp);
if (n.groupId.isNotEmpty())
{
env->CallObjectMethod (notificationBuilder, NotificationBuilderApi20.setGroup, javaString (n.groupId).get());
env->CallObjectMethod (notificationBuilder, NotificationBuilderApi20.setGroupSummary, n.groupSummary);
env->CallObjectMethod (notificationBuilder, NotificationBuilderBase.setGroup, javaString (n.groupId).get());
env->CallObjectMethod (notificationBuilder, NotificationBuilderBase.setGroupSummary, n.groupSummary);
}
if (n.groupSortKey.isNotEmpty())
env->CallObjectMethod (notificationBuilder, NotificationBuilderApi20.setSortKey, javaString (n.groupSortKey).get());
env->CallObjectMethod (notificationBuilder, NotificationBuilderBase.setSortKey, javaString (n.groupSortKey).get());
env->CallObjectMethod (notificationBuilder, NotificationBuilderApi20.setLocalOnly, n.localOnly);
env->CallObjectMethod (notificationBuilder, NotificationBuilderBase.setLocalOnly, n.localOnly);
auto extras = LocalRef<jobject> (env->NewObject (AndroidBundle, AndroidBundle.constructor));
env->CallVoidMethod (extras, AndroidBundle.putBundle, javaString ("notificationData").get(),
juceNotificationToBundle (n).get());
env->CallObjectMethod (notificationBuilder, NotificationBuilderApi20.addExtras, extras.get());
env->CallObjectMethod (notificationBuilder, NotificationBuilderBase.addExtras, extras.get());
if (n.person.isNotEmpty())
env->CallObjectMethod (notificationBuilder, NotificationBuilderApi21.addPerson, javaString (n.person).get());
env->CallObjectMethod (notificationBuilder, NotificationBuilderBase.addPerson, javaString (n.person).get());
auto categoryString = typeToCategory (n.type);
if (categoryString.isNotEmpty())
env->CallObjectMethod (notificationBuilder, NotificationBuilderApi21.setCategory, javaString (categoryString).get());
env->CallObjectMethod (notificationBuilder, NotificationBuilderBase.setCategory, javaString (categoryString).get());
if (n.accentColour != Colour())
env->CallObjectMethod (notificationBuilder, NotificationBuilderApi21.setColor, n.accentColour.getARGB());
env->CallObjectMethod (notificationBuilder, NotificationBuilderBase.setColor, n.accentColour.getARGB());
env->CallObjectMethod (notificationBuilder, NotificationBuilderApi21.setVisibility, n.lockScreenAppearance);
env->CallObjectMethod (notificationBuilder, NotificationBuilderBase.setVisibility, n.lockScreenAppearance);
if (getAndroidSDKVersion() >= 24)
{
const bool useChronometer = n.timestampVisibility == Notification::chronometer;
const bool useCountDownChronometer = n.timestampVisibility == Notification::countDownChronometer;
const bool useChronometer = n.timestampVisibility == Notification::chronometer;
const bool useCountDownChronometer = n.timestampVisibility == Notification::countDownChronometer;
env->CallObjectMethod (notificationBuilder, NotificationBuilderApi24.setChronometerCountDown, useCountDownChronometer);
env->CallObjectMethod (notificationBuilder, NotificationBuilderApi16.setUsesChronometer, useChronometer | useCountDownChronometer);
}
env->CallObjectMethod (notificationBuilder, NotificationBuilderBase.setChronometerCountDown, useCountDownChronometer);
env->CallObjectMethod (notificationBuilder, NotificationBuilderBase.setUsesChronometer, useChronometer | useCountDownChronometer);
if (getAndroidSDKVersion() >= 26)
{
@ -1045,7 +988,7 @@ struct PushNotifications::Impl
env->CallObjectMethod (remoteInputBuilder, RemoteInputBuilder.build));
}
env->CallObjectMethod (notificationBuilder, NotificationBuilderApi20.addAction,
env->CallObjectMethod (notificationBuilder, NotificationBuilderBase.addAction,
env->CallObjectMethod (actionBuilder, NotificationActionBuilder.build));
}

View file

@ -103,7 +103,7 @@ static const uint8 CameraSupportByteCode[] =
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
STATICMETHOD (valueOf, "valueOf", "(Ljava/lang/String;)Landroid/graphics/Bitmap$CompressFormat;")
DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidBitmapCompressFormat, "android/graphics/Bitmap$CompressFormat", 21)
DECLARE_JNI_CLASS (AndroidBitmapCompressFormat, "android/graphics/Bitmap$CompressFormat")
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
@ -111,20 +111,20 @@ DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidBitmapCompressFormat, "android/graphics/B
METHOD (createCaptureRequest, "createCaptureRequest", "(I)Landroid/hardware/camera2/CaptureRequest$Builder;") \
METHOD (createCaptureSession, "createCaptureSession", "(Ljava/util/List;Landroid/hardware/camera2/CameraCaptureSession$StateCallback;Landroid/os/Handler;)V")
DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidCameraDevice, "android/hardware/camera2/CameraDevice", 21)
DECLARE_JNI_CLASS (AndroidCameraDevice, "android/hardware/camera2/CameraDevice")
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
METHOD (close, "close", "()V") \
METHOD (getPlanes, "getPlanes", "()[Landroid/media/Image$Plane;")
DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidImage, "android/media/Image", 21)
DECLARE_JNI_CLASS (AndroidImage, "android/media/Image")
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
METHOD (getBuffer, "getBuffer", "()Ljava/nio/ByteBuffer;")
DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidImagePlane, "android/media/Image$Plane", 21)
DECLARE_JNI_CLASS (AndroidImagePlane, "android/media/Image$Plane")
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
@ -134,7 +134,7 @@ DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidImagePlane, "android/media/Image$Plane",
METHOD (setOnImageAvailableListener, "setOnImageAvailableListener", "(Landroid/media/ImageReader$OnImageAvailableListener;Landroid/os/Handler;)V") \
STATICMETHOD (newInstance, "newInstance", "(IIII)Landroid/media/ImageReader;")
DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidImageReader, "android/media/ImageReader", 21)
DECLARE_JNI_CLASS (AndroidImageReader, "android/media/ImageReader")
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
@ -157,7 +157,7 @@ DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidImageReader, "android/media/ImageReader",
METHOD (start, "start", "()V") \
METHOD (stop, "stop", "()V")
DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidMediaRecorder, "android/media/MediaRecorder", 21)
DECLARE_JNI_CLASS (AndroidMediaRecorder, "android/media/MediaRecorder")
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
@ -167,19 +167,19 @@ DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidMediaRecorder, "android/media/MediaRecord
METHOD (setSurfaceTextureListener, "setSurfaceTextureListener", "(Landroid/view/TextureView$SurfaceTextureListener;)V") \
METHOD (setTransform, "setTransform", "(Landroid/graphics/Matrix;)V")
DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidTextureView, "android/view/TextureView", 21)
DECLARE_JNI_CLASS (AndroidTextureView, "android/view/TextureView")
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
METHOD (constructor, "<init>", "(Landroid/graphics/SurfaceTexture;)V")
DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidSurface, "android/view/Surface", 21)
DECLARE_JNI_CLASS (AndroidSurface, "android/view/Surface")
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
METHOD (setDefaultBufferSize, "setDefaultBufferSize", "(II)V")
DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidSurfaceTexture, "android/graphics/SurfaceTexture", 21)
DECLARE_JNI_CLASS (AndroidSurfaceTexture, "android/graphics/SurfaceTexture")
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
@ -188,7 +188,7 @@ DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidSurfaceTexture, "android/graphics/Surface
METHOD (isOutputSupportedFor, "isOutputSupportedFor", "(I)Z") \
METHOD (isOutputSupportedForSurface, "isOutputSupportedFor", "(Landroid/view/Surface;)Z")
DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidStreamConfigurationMap, "android/hardware/camera2/params/StreamConfigurationMap", 21)
DECLARE_JNI_CLASS (AndroidStreamConfigurationMap, "android/hardware/camera2/params/StreamConfigurationMap")
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
@ -196,7 +196,7 @@ DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidStreamConfigurationMap, "android/hardware
METHOD (toByteArray, "toByteArray", "()[B") \
METHOD (size, "size", "()I")
DECLARE_JNI_CLASS_WITH_MIN_SDK (ByteArrayOutputStream, "java/io/ByteArrayOutputStream", 21)
DECLARE_JNI_CLASS (ByteArrayOutputStream, "java/io/ByteArrayOutputStream")
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
@ -206,7 +206,7 @@ DECLARE_JNI_CLASS_WITH_MIN_SDK (ByteArrayOutputStream, "java/io/ByteArrayOutputS
METHOD (setRepeatingRequest, "setRepeatingRequest", "(Landroid/hardware/camera2/CaptureRequest;Landroid/hardware/camera2/CameraCaptureSession$CaptureCallback;Landroid/os/Handler;)I") \
METHOD (stopRepeating, "stopRepeating", "()V")
DECLARE_JNI_CLASS_WITH_MIN_SDK (CameraCaptureSession, "android/hardware/camera2/CameraCaptureSession", 21)
DECLARE_JNI_CLASS (CameraCaptureSession, "android/hardware/camera2/CameraCaptureSession")
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
@ -217,13 +217,13 @@ DECLARE_JNI_CLASS_WITH_MIN_SDK (CameraCaptureSession, "android/hardware/camera2/
STATICFIELD (SCALER_STREAM_CONFIGURATION_MAP, "SCALER_STREAM_CONFIGURATION_MAP", "Landroid/hardware/camera2/CameraCharacteristics$Key;") \
STATICFIELD (SENSOR_ORIENTATION, "SENSOR_ORIENTATION", "Landroid/hardware/camera2/CameraCharacteristics$Key;")
DECLARE_JNI_CLASS_WITH_MIN_SDK (CameraCharacteristics, "android/hardware/camera2/CameraCharacteristics", 21)
DECLARE_JNI_CLASS (CameraCharacteristics, "android/hardware/camera2/CameraCharacteristics")
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
METHOD (getName, "getName", "()Ljava/lang/String;")
DECLARE_JNI_CLASS_WITH_MIN_SDK (CameraCharacteristicsKey, "android/hardware/camera2/CameraCharacteristics$Key", 21)
DECLARE_JNI_CLASS (CameraCharacteristicsKey, "android/hardware/camera2/CameraCharacteristics$Key")
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
@ -231,7 +231,7 @@ DECLARE_JNI_CLASS_WITH_MIN_SDK (CameraCharacteristicsKey, "android/hardware/came
METHOD (getCameraIdList, "getCameraIdList", "()[Ljava/lang/String;") \
METHOD (openCamera, "openCamera", "(Ljava/lang/String;Landroid/hardware/camera2/CameraDevice$StateCallback;Landroid/os/Handler;)V")
DECLARE_JNI_CLASS_WITH_MIN_SDK (CameraManager, "android/hardware/camera2/CameraManager", 21)
DECLARE_JNI_CLASS (CameraManager, "android/hardware/camera2/CameraManager")
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
@ -240,7 +240,7 @@ DECLARE_JNI_CLASS_WITH_MIN_SDK (CameraManager, "android/hardware/camera2/CameraM
STATICFIELD (CONTROL_AF_TRIGGER, "CONTROL_AF_TRIGGER", "Landroid/hardware/camera2/CaptureRequest$Key;") \
STATICFIELD (CONTROL_MODE, "CONTROL_MODE", "Landroid/hardware/camera2/CaptureRequest$Key;")
DECLARE_JNI_CLASS_WITH_MIN_SDK (CaptureRequest, "android/hardware/camera2/CaptureRequest", 21)
DECLARE_JNI_CLASS (CaptureRequest, "android/hardware/camera2/CaptureRequest")
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
@ -248,7 +248,7 @@ DECLARE_JNI_CLASS_WITH_MIN_SDK (CaptureRequest, "android/hardware/camera2/Captur
METHOD (build, "build", "()Landroid/hardware/camera2/CaptureRequest;") \
METHOD (set, "set", "(Landroid/hardware/camera2/CaptureRequest$Key;Ljava/lang/Object;)V")
DECLARE_JNI_CLASS_WITH_MIN_SDK (CaptureRequestBuilder, "android/hardware/camera2/CaptureRequest$Builder", 21)
DECLARE_JNI_CLASS (CaptureRequestBuilder, "android/hardware/camera2/CaptureRequest$Builder")
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
@ -256,7 +256,7 @@ DECLARE_JNI_CLASS_WITH_MIN_SDK (CaptureRequestBuilder, "android/hardware/camera2
STATICFIELD (CONTROL_AE_STATE, "CONTROL_AE_STATE", "Landroid/hardware/camera2/CaptureResult$Key;") \
STATICFIELD (CONTROL_AF_STATE, "CONTROL_AF_STATE", "Landroid/hardware/camera2/CaptureResult$Key;")
DECLARE_JNI_CLASS_WITH_MIN_SDK (CaptureResult, "android/hardware/camera2/CaptureResult", 21)
DECLARE_JNI_CLASS (CaptureResult, "android/hardware/camera2/CaptureResult")
#undef JNI_CLASS_MEMBERS
//==============================================================================
@ -2101,7 +2101,7 @@ private:
CALLBACK (generatedCallback<&CaptureSession::cameraCaptureSessionConfiguredCallback>, "cameraCaptureSessionConfigured", "(JLandroid/hardware/camera2/CameraCaptureSession;)V") \
CALLBACK (generatedCallback<&CaptureSession::cameraCaptureSessionReadyCallback>, "cameraCaptureSessionReady", "(JLandroid/hardware/camera2/CameraCaptureSession;)V")
DECLARE_JNI_CLASS_WITH_MIN_SDK (CameraCaptureSessionStateCallback, "com/rmsl/juce/CameraCaptureSessionStateCallback", 21)
DECLARE_JNI_CLASS (CameraCaptureSessionStateCallback, "com/rmsl/juce/CameraCaptureSessionStateCallback")
#undef JNI_CLASS_MEMBERS
@ -2318,7 +2318,7 @@ private:
CALLBACK (generatedCallback<&ScopedCameraDevice::cameraDeviceStateErrorCallback>, "cameraDeviceStateError", "(JLandroid/hardware/camera2/CameraDevice;I)V") \
CALLBACK (generatedCallback<&ScopedCameraDevice::cameraDeviceStateOpenedCallback>, "cameraDeviceStateOpened", "(JLandroid/hardware/camera2/CameraDevice;)V")
DECLARE_JNI_CLASS_WITH_MIN_SDK (CameraDeviceStateCallback, "com/rmsl/juce/CameraDeviceStateCallback", 21)
DECLARE_JNI_CLASS (CameraDeviceStateCallback, "com/rmsl/juce/CameraDeviceStateCallback")
#undef JNI_CLASS_MEMBERS
LocalRef<jobject> createCameraStateCallbackObject()
@ -2730,7 +2730,7 @@ private:
METHOD (enable, "enable", "()V") \
CALLBACK (generatedCallback<&DeviceOrientationChangeListener::orientationChanged>, "deviceOrientationChanged", "(JI)V")
DECLARE_JNI_CLASS_WITH_MIN_SDK (OrientationEventListener, "com/rmsl/juce/JuceOrientationEventListener", 21)
DECLARE_JNI_CLASS (OrientationEventListener, "com/rmsl/juce/JuceOrientationEventListener")
#undef JNI_CLASS_MEMBERS
LocalRef<jobject> createOrientationEventListener()

View file

@ -112,7 +112,7 @@ static const uint8 MediaSessionByteCode[] =
METHOD (setVolumeTo, "setVolumeTo", "(II)V") \
METHOD (unregisterCallback, "unregisterCallback", "(Landroid/media/session/MediaController$Callback;)V")
DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidMediaController, "android/media/session/MediaController", 21)
DECLARE_JNI_CLASS (AndroidMediaController, "android/media/session/MediaController")
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
@ -120,7 +120,7 @@ DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidMediaController, "android/media/session/M
METHOD (getCurrentVolume, "getCurrentVolume", "()I") \
METHOD (getMaxVolume, "getMaxVolume", "()I")
DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidMediaControllerPlaybackInfo, "android/media/session/MediaController$PlaybackInfo", 21)
DECLARE_JNI_CLASS (AndroidMediaControllerPlaybackInfo, "android/media/session/MediaController$PlaybackInfo")
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
@ -130,7 +130,7 @@ DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidMediaControllerPlaybackInfo, "android/med
METHOD (seekTo, "seekTo", "(J)V") \
METHOD (stop, "stop", "()V")
DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidMediaControllerTransportControls, "android/media/session/MediaController$TransportControls", 21)
DECLARE_JNI_CLASS (AndroidMediaControllerTransportControls, "android/media/session/MediaController$TransportControls")
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
@ -159,7 +159,7 @@ DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidMediaControllerTransportControls, "androi
METHOD (start, "start", "()V") \
METHOD (stop, "stop", "()V")
DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidMediaPlayer, "android/media/MediaPlayer", 21)
DECLARE_JNI_CLASS (AndroidMediaPlayer, "android/media/MediaPlayer")
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
@ -174,7 +174,7 @@ DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidMediaPlayer, "android/media/MediaPlayer",
METHOD (setPlaybackState, "setPlaybackState", "(Landroid/media/session/PlaybackState;)V") \
METHOD (setPlaybackToLocal, "setPlaybackToLocal", "(Landroid/media/AudioAttributes;)V")
DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidMediaSession, "android/media/session/MediaSession", 21)
DECLARE_JNI_CLASS (AndroidMediaSession, "android/media/session/MediaSession")
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
@ -182,14 +182,14 @@ DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidMediaSession, "android/media/session/Medi
METHOD (constructor, "<init>", "()V") \
METHOD (putLong, "putLong", "(Ljava/lang/String;J)Landroid/media/MediaMetadata$Builder;")
DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidMediaMetadataBuilder, "android/media/MediaMetadata$Builder", 21)
DECLARE_JNI_CLASS (AndroidMediaMetadataBuilder, "android/media/MediaMetadata$Builder")
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
METHOD (getSpeed, "getSpeed", "()F") \
METHOD (setSpeed, "setSpeed", "(F)Landroid/media/PlaybackParams;")
DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidPlaybackParams, "android/media/PlaybackParams", 21)
DECLARE_JNI_CLASS (AndroidPlaybackParams, "android/media/PlaybackParams")
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
@ -199,7 +199,7 @@ DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidPlaybackParams, "android/media/PlaybackPa
METHOD (getPosition, "getPosition", "()J") \
METHOD (getState, "getState", "()I")
DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidPlaybackState, "android/media/session/PlaybackState", 21)
DECLARE_JNI_CLASS (AndroidPlaybackState, "android/media/session/PlaybackState")
#undef JNI_CLASS_MEMBERS
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
@ -209,7 +209,7 @@ DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidPlaybackState, "android/media/session/Pla
METHOD (setErrorMessage, "setErrorMessage", "(Ljava/lang/CharSequence;)Landroid/media/session/PlaybackState$Builder;") \
METHOD (setState, "setState", "(IJF)Landroid/media/session/PlaybackState$Builder;")
DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidPlaybackStateBuilder, "android/media/session/PlaybackState$Builder", 21)
DECLARE_JNI_CLASS (AndroidPlaybackStateBuilder, "android/media/session/PlaybackState$Builder")
#undef JNI_CLASS_MEMBERS
//==============================================================================
@ -1283,7 +1283,7 @@ private:
CALLBACK (generatedCallback<&MediaSession::seekToCallback>, "mediaSessionSeekTo", "(JJ)V") \
CALLBACK (generatedCallback<&MediaSession::stopCallback>, "mediaSessionStop", "(J)V")
DECLARE_JNI_CLASS_WITH_MIN_SDK (AndroidMediaSessionCallback, "com/rmsl/juce/MediaSessionCallback", 21)
DECLARE_JNI_CLASS (AndroidMediaSessionCallback, "com/rmsl/juce/MediaSessionCallback")
#undef JNI_CLASS_MEMBERS
LocalRef<jobject> createCallbackObject()
@ -1654,7 +1654,7 @@ private:
METHOD (setEnabled, "setEnabled", "(Z)V") \
CALLBACK (generatedCallback<&SystemVolumeListener::systemVolumeChanged>, "mediaSessionSystemVolumeChanged", "(J)V")
DECLARE_JNI_CLASS_WITH_MIN_SDK (SystemVolumeObserver, "com/rmsl/juce/SystemVolumeObserver", 21)
DECLARE_JNI_CLASS (SystemVolumeObserver, "com/rmsl/juce/SystemVolumeObserver")
#undef JNI_CLASS_MEMBERS