├── .gitignore ├── CMakeLists.txt ├── LICENSE ├── README ├── jutils ├── jni.inc ├── jutils-details.hpp ├── jutils.cpp └── jutils.hpp └── src ├── Activity.cpp ├── Activity.h ├── ActivityManager.cpp ├── ActivityManager.h ├── ApplicationInfo.cpp ├── ApplicationInfo.h ├── ArrayList.cpp ├── ArrayList.h ├── AudioAttributes.cpp ├── AudioAttributes.h ├── AudioDeviceInfo.cpp ├── AudioDeviceInfo.h ├── AudioFocusRequest.cpp ├── AudioFocusRequest.h ├── AudioFormat.cpp ├── AudioFormat.h ├── AudioManager.cpp ├── AudioManager.h ├── AudioTimestamp.cpp ├── AudioTimestamp.h ├── AudioTrack.cpp ├── AudioTrack.h ├── BaseColumns.cpp ├── BaseColumns.h ├── BitSet.cpp ├── BitSet.h ├── Bitmap.cpp ├── Bitmap.h ├── BitmapDrawable.cpp ├── BitmapDrawable.h ├── BitmapFactory.cpp ├── BitmapFactory.h ├── BroadcastReceiver.cpp ├── BroadcastReceiver.h ├── Buffer.cpp ├── Buffer.h ├── Build.cpp ├── Build.h ├── Bundle.cpp ├── Bundle.h ├── ByteBuffer.cpp ├── ByteBuffer.h ├── Canvas.cpp ├── Canvas.h ├── CharSequence.cpp ├── CharSequence.h ├── ClassLoader.cpp ├── ClassLoader.h ├── ConnectivityManager.cpp ├── ConnectivityManager.h ├── ContentResolver.cpp ├── ContentResolver.h ├── Context.cpp ├── Context.h ├── Cursor.cpp ├── Cursor.h ├── DhcpInfo.cpp ├── DhcpInfo.h ├── Display.cpp ├── Display.h ├── DisplayManager.cpp ├── DisplayManager.h ├── DisplayMetrics.cpp ├── DisplayMetrics.h ├── Document.cpp ├── Document.h ├── DocumentsContract.cpp ├── DocumentsContract.h ├── Drawable.cpp ├── Drawable.h ├── Enum.cpp ├── Enum.h ├── Environment.cpp ├── Environment.h ├── File.cpp ├── File.h ├── FileDescriptor.cpp ├── FileDescriptor.h ├── FileProvider.cpp ├── FileProvider.h ├── HashMap.cpp ├── HashMap.h ├── IBinder.cpp ├── IBinder.h ├── IInterface.cpp ├── IInterface.h ├── Image.cpp ├── Image.h ├── InetAddress.cpp ├── InetAddress.h ├── InputManager.cpp ├── InputManager.h ├── Intent.cpp ├── Intent.h ├── IntentFilter.cpp ├── IntentFilter.h ├── Iterator.cpp ├── Iterator.h ├── JNIBase.cpp ├── JNIBase.h ├── JNIThreading.cpp ├── JNIThreading.h ├── KeyCharacterMap.cpp ├── KeyCharacterMap.h ├── KeyEvent.cpp ├── KeyEvent.h ├── LinkAddress.cpp ├── LinkAddress.h ├── LinkProperties.cpp ├── LinkProperties.h ├── List.cpp ├── List.h ├── Map.cpp ├── Map.h ├── MediaCodec.cpp ├── MediaCodec.h ├── MediaCodecBufferInfo.cpp ├── MediaCodecBufferInfo.h ├── MediaCodecCryptoInfo.cpp ├── MediaCodecCryptoInfo.h ├── MediaCodecCryptoInfoPattern.cpp ├── MediaCodecCryptoInfoPattern.h ├── MediaCodecInfo.cpp ├── MediaCodecInfo.h ├── MediaCodecList.cpp ├── MediaCodecList.h ├── MediaCrypto.cpp ├── MediaCrypto.h ├── MediaDrm.cpp ├── MediaDrm.h ├── MediaDrmCryptoSession.cpp ├── MediaDrmCryptoSession.h ├── MediaDrmKeyRequest.cpp ├── MediaDrmKeyRequest.h ├── MediaDrmOnEventListener.cpp ├── MediaDrmOnEventListener.h ├── MediaDrmProvisionRequest.cpp ├── MediaDrmProvisionRequest.h ├── MediaFormat.cpp ├── MediaFormat.h ├── MediaMetadata.cpp ├── MediaMetadata.h ├── MediaRouteSelector.cpp ├── MediaRouteSelector.h ├── MediaRouter.cpp ├── MediaRouter.h ├── MediaStore.cpp ├── MediaStore.h ├── MediaSync.cpp ├── MediaSync.h ├── MediaTimestamp.cpp ├── MediaTimestamp.h ├── Network.cpp ├── Network.h ├── NetworkInfo.cpp ├── NetworkInfo.h ├── NetworkInterface.cpp ├── NetworkInterface.h ├── Notification.cpp ├── Notification.h ├── NsdManager.cpp ├── NsdManager.h ├── NsdServiceInfo.cpp ├── NsdServiceInfo.h ├── Os.cpp ├── Os.h ├── PackageItemInfo.cpp ├── PackageItemInfo.h ├── PackageManager.cpp ├── PackageManager.h ├── Parcel.cpp ├── Parcel.h ├── PendingIntent.cpp ├── PendingIntent.h ├── PlaybackParams.cpp ├── PlaybackParams.h ├── PlaybackState.cpp ├── PlaybackState.h ├── PowerManager.cpp ├── PowerManager.h ├── RecognizerIntent.cpp ├── RecognizerIntent.h ├── Rect.cpp ├── Rect.h ├── Resources.cpp ├── Resources.h ├── RouteInfo.cpp ├── RouteInfo.h ├── ScanResult.cpp ├── ScanResult.h ├── ServiceManager.cpp ├── ServiceManager.h ├── Set.cpp ├── Set.h ├── Settings.cpp ├── Settings.h ├── SpeechRecognizer.cpp ├── SpeechRecognizer.h ├── StatFs.cpp ├── StatFs.h ├── StorageManager.cpp ├── StorageManager.h ├── StorageVolume.cpp ├── StorageVolume.h ├── Surface.cpp ├── Surface.h ├── SurfaceHolder.cpp ├── SurfaceHolder.h ├── SurfaceTexture.cpp ├── SurfaceTexture.h ├── SurfaceView.cpp ├── SurfaceView.h ├── System.cpp ├── System.h ├── SystemClock.cpp ├── SystemClock.h ├── SystemProperties.cpp ├── SystemProperties.h ├── URI.cpp ├── URI.h ├── URIPermission.cpp ├── URIPermission.h ├── UUID.cpp ├── UUID.h ├── View.cpp ├── View.h ├── WakeLock.cpp ├── WakeLock.h ├── WifiConfiguration.cpp ├── WifiConfiguration.h ├── WifiInfo.cpp ├── WifiInfo.h ├── WifiManager.cpp ├── WifiManager.h ├── WifiManagerMulticastLock.cpp ├── WifiManagerMulticastLock.h ├── Window.cpp ├── Window.h ├── WindowManager.cpp └── WindowManager.h /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files 2 | *.slo 3 | *.lo 4 | *.o 5 | *.obj 6 | 7 | # Precompiled Headers 8 | *.gch 9 | *.pch 10 | 11 | # Compiled Dynamic libraries 12 | *.so 13 | *.dylib 14 | *.dll 15 | 16 | # Fortran module files 17 | *.mod 18 | *.smod 19 | 20 | # Compiled Static libraries 21 | *.lai 22 | *.la 23 | *.a 24 | *.lib 25 | 26 | # Executables 27 | *.exe 28 | *.out 29 | *.app 30 | 31 | # Generated 32 | *.P 33 | Makefile 34 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # cmake -DCMAKE_BUILD_TYPE=Debug .. 2 | # cmake -DCMAKE_BUILD_TYPE=Release .. 3 | cmake_minimum_required(VERSION 2.8) 4 | project(androidjni) 5 | 6 | # Compiler warning and optimization flags 7 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-undefined-var-template") 8 | 9 | # androidjni Library 10 | file(GLOB ANDJNI_SOURCES 11 | jutils/*.cpp 12 | src/*.cpp 13 | ) 14 | include_directories(BEFORE ${PROJECT_SOURCE_DIR}/jutils) 15 | add_library(androidjni STATIC ${ANDJNI_SOURCES}) 16 | install (TARGETS androidjni ARCHIVE DESTINATION lib) 17 | file(GLOB_RECURSE header_files "*.h" "*.hpp" "*.inc") 18 | install (FILES ${header_files} DESTINATION include/androidjni) 19 | -------------------------------------------------------------------------------- /src/Activity.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2014 Team XBMC 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | #include "Context.h" 24 | #include "Intent.h" 25 | 26 | class CJNIWindowManager; 27 | class CVariant; 28 | class CJNIView; 29 | 30 | struct ANativeActivity; 31 | 32 | class CJNIActivity : public CJNIContext 33 | { 34 | public: 35 | CJNIActivity(const ANativeActivity *nativeActivity); 36 | ~CJNIActivity(); 37 | 38 | static CJNIWindowManager getWindowManager(); 39 | static bool moveTaskToBack(bool nonRoot); 40 | static void startActivityForResult(const CJNIIntent &intent, int requestCode); 41 | // Deprecated in API level 26 42 | static bool requestVisibleBehind(bool visible); 43 | static CJNIView findViewById(const int id); 44 | 45 | virtual void onVisibleBehindCanceled() = 0; 46 | 47 | private: 48 | CJNIActivity(); 49 | }; 50 | 51 | -------------------------------------------------------------------------------- /src/ActivityManager.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Team XBMC 3 | * http://xbmc.org 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with XBMC; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | #include "ActivityManager.h" 22 | 23 | #include "JNIBase.h" 24 | #include "jutils-details.hpp" 25 | 26 | using namespace jni; 27 | 28 | CJNIActivityManager::MemoryInfo::MemoryInfo() 29 | : CJNIBase("android/app/ActivityManager$MemoryInfo") 30 | { 31 | m_object = new_object(GetClassName(), "", "()V"); 32 | m_object.setGlobal(); 33 | } 34 | 35 | long CJNIActivityManager::MemoryInfo::availMem() const 36 | { 37 | return get_field(m_object, "availMem"); 38 | } 39 | 40 | long CJNIActivityManager::MemoryInfo::totalMem() const 41 | { 42 | return get_field(m_object, "totalMem"); 43 | } 44 | 45 | /***********/ 46 | 47 | void CJNIActivityManager::getMemoryInfo(MemoryInfo& info) const 48 | { 49 | call_method(m_object, "getMemoryInfo", "(Landroid/app/ActivityManager$MemoryInfo;)V", info.get_raw()); 50 | } 51 | -------------------------------------------------------------------------------- /src/ActivityManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2013 Team XBMC 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | #include "jutils-details.hpp" 24 | 25 | class CJNIMemoryInfo; 26 | 27 | class CJNIActivityManager : public CJNIBase 28 | { 29 | public: 30 | class MemoryInfo : public CJNIBase 31 | { 32 | public: 33 | MemoryInfo(); 34 | 35 | long availMem() const; 36 | long totalMem() const; 37 | }; 38 | 39 | CJNIActivityManager(const jni::jhobject &object) : CJNIBase(object) {}; 40 | ~CJNIActivityManager() {}; 41 | 42 | void getMemoryInfo(MemoryInfo& info) const; 43 | 44 | protected: 45 | CJNIActivityManager(); 46 | }; 47 | -------------------------------------------------------------------------------- /src/ApplicationInfo.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Team XBMC 3 | * http://xbmc.org 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with XBMC; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | #include "ApplicationInfo.h" 22 | #include "jutils-details.hpp" 23 | 24 | using namespace jni; 25 | 26 | CJNIApplicationInfo::CJNIApplicationInfo(const jhobject &object) : CJNIPackageItemInfo(object) 27 | ,sourceDir( jcast(get_field(m_object, "sourceDir"))) 28 | ,publicSourceDir( jcast(get_field(m_object, "publicSourceDir"))) 29 | ,dataDir( jcast(get_field(m_object, "dataDir"))) 30 | ,nativeLibraryDir(jcast(get_field(m_object, "nativeLibraryDir"))) 31 | ,packageName( jcast(get_field(m_object, "packageName"))) 32 | ,uid( get_field(m_object, "uid")) 33 | ,targetSdkVersion(get_field(m_object, "targetSdkVersion")) 34 | ,enabled( get_field(m_object, "enabled")) 35 | { 36 | } 37 | -------------------------------------------------------------------------------- /src/ApplicationInfo.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2013 Team XBMC 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include 23 | #include 24 | 25 | #include "JNIBase.h" 26 | #include "PackageItemInfo.h" 27 | 28 | class CJNIApplicationInfo : public CJNIPackageItemInfo 29 | { 30 | public: 31 | CJNIApplicationInfo(const jni::jhobject &object); 32 | ~CJNIApplicationInfo(){}; 33 | 34 | std::string sourceDir; 35 | std::string publicSourceDir; 36 | std::string dataDir; 37 | std::string nativeLibraryDir; 38 | std::string packageName; 39 | int uid; 40 | int targetSdkVersion; 41 | bool enabled; 42 | 43 | private: 44 | CJNIApplicationInfo(); 45 | }; 46 | 47 | typedef std::vector CJNIApplicationInfos; 48 | -------------------------------------------------------------------------------- /src/ArrayList.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Team XBMC 3 | * http://xbmc.org 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with XBMC; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | #include "ArrayList.h" 22 | 23 | #include "jutils-details.hpp" 24 | 25 | using namespace jni; 26 | 27 | template 28 | T CJNIArrayList::get(int index) 29 | { 30 | return (T)call_method(m_object, 31 | "get", "(I)Ljava/lang/Object;", 32 | index); 33 | } 34 | 35 | template <> 36 | std::string CJNIArrayList::get(int index) 37 | { 38 | return jcast(call_method(m_object, 39 | "get", "(I)Ljava/lang/Object;", 40 | index)); 41 | } 42 | 43 | 44 | template 45 | int CJNIArrayList::size() 46 | { 47 | return m_object.get() ? call_method(m_object, 48 | "size", "()I") : 0; 49 | } 50 | 51 | template class CJNIArrayList; 52 | -------------------------------------------------------------------------------- /src/ArrayList.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2013 Team XBMC 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | template 25 | class CJNIArrayList : public CJNIBase 26 | { 27 | public: 28 | CJNIArrayList(const jni::jhobject &object) : CJNIBase(object){}; 29 | ~CJNIArrayList(){}; 30 | 31 | T get(int index); 32 | int size(); 33 | 34 | private: 35 | CJNIArrayList(); 36 | }; 37 | 38 | template <> std::string CJNIArrayList::get(int index); 39 | -------------------------------------------------------------------------------- /src/AudioFocusRequest.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2021- Team Kodi 4 | * This file is part of Kodi - https://kodi.tv 5 | * 6 | * SPDX-License-Identifier: GPL-2.0-or-later 7 | * See LICENSES/README.md for more information. 8 | */ 9 | 10 | #include "JNIBase.h" 11 | 12 | #include "AudioAttributes.h" 13 | 14 | class CJNIAudioManagerAudioFocusChangeListener; 15 | 16 | namespace jni 17 | { 18 | 19 | class CJNIAudioFocusRequestClass : public CJNIBase 20 | { 21 | public: 22 | CJNIAudioFocusRequestClass(const CJNIAudioFocusRequestClass& other) : CJNIBase(other) {} 23 | CJNIAudioFocusRequestClass(const jni::jhobject &object) : CJNIBase(object) {} 24 | 25 | protected: 26 | static const char *m_classname; 27 | 28 | }; 29 | 30 | class CJNIAudioFocusRequestClassBuilder : public CJNIBase 31 | { 32 | public: 33 | CJNIAudioFocusRequestClassBuilder(int focusgain); 34 | CJNIAudioFocusRequestClassBuilder(const CJNIAudioFocusRequestClassBuilder& other) : CJNIBase(other) {} 35 | CJNIAudioFocusRequestClassBuilder(const jni::jhobject &object) : CJNIBase(object) {} 36 | 37 | CJNIAudioFocusRequestClass build(); 38 | 39 | CJNIAudioFocusRequestClassBuilder setAcceptsDelayedFocusGain(bool acceptsDelayedFocusGain); 40 | CJNIAudioFocusRequestClassBuilder setAudioAttributes(CJNIAudioAttributes attributes); 41 | CJNIAudioFocusRequestClassBuilder setFocusGain(int focusGain); 42 | CJNIAudioFocusRequestClassBuilder setForceDucking(bool forceDucking); 43 | CJNIAudioFocusRequestClassBuilder setWillPauseWhenDucked(bool pauseOnDuck); 44 | 45 | CJNIAudioFocusRequestClassBuilder setOnAudioFocusChangeListener(const CJNIAudioManagerAudioFocusChangeListener& listener); 46 | // CJNIAudioFocusRequestClassBuilder setOnAudioFocusChangeListener(const CJNIAudioManagerAudioFocusChangeListener& listener, Handler handler) 47 | 48 | protected: 49 | static const char *m_classname; 50 | }; 51 | } // namespace jni 52 | -------------------------------------------------------------------------------- /src/AudioTimestamp.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Chris Browet 3 | * 4 | * This Program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2, or (at your option) 7 | * any later version. 8 | * 9 | * This Program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with XBMC; see the file COPYING. If not, see 16 | * . 17 | * 18 | */ 19 | 20 | #include "AudioTimestamp.h" 21 | #include "jutils-details.hpp" 22 | 23 | using namespace jni; 24 | 25 | CJNIAudioTimestamp::CJNIAudioTimestamp() : CJNIBase("android.media.AudioTimestamp") 26 | { 27 | m_object = new_object(GetClassName()); 28 | m_object.setGlobal(); 29 | } 30 | 31 | CJNIAudioTimestamp::CJNIAudioTimestamp(const jhobject &object) : CJNIBase(object) 32 | { 33 | } 34 | 35 | int64_t CJNIAudioTimestamp::get_framePosition() 36 | { 37 | return get_field(m_object, "framePosition"); 38 | } 39 | 40 | int64_t CJNIAudioTimestamp::get_nanoTime() 41 | { 42 | return get_field(m_object, "nanoTime"); 43 | } 44 | -------------------------------------------------------------------------------- /src/AudioTimestamp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2016 Chris Browet 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with XBMC; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | #include "JNIBase.h" 22 | 23 | class CJNIAudioTimestamp : public CJNIBase 24 | { 25 | public: 26 | CJNIAudioTimestamp(); 27 | CJNIAudioTimestamp(const jni::jhobject &object); 28 | ~CJNIAudioTimestamp() {}; 29 | 30 | int64_t get_framePosition(); 31 | int64_t get_nanoTime(); 32 | 33 | private: 34 | }; 35 | -------------------------------------------------------------------------------- /src/BaseColumns.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Team XBMC 3 | * http://xbmc.org 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with XBMC; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | #include "BaseColumns.h" 22 | #include "jutils-details.hpp" 23 | 24 | using namespace jni; 25 | 26 | std::string CJNIBaseColumns::_ID; 27 | std::string CJNIBaseColumns::_COUNT; 28 | 29 | void CJNIBaseColumns::PopulateStaticFields() 30 | { 31 | jhclass clazz = find_class("android/provider/BaseColumns"); 32 | _ID = (jcast(get_static_field(clazz, "_ID"))); 33 | _COUNT = (jcast(get_static_field(clazz, "_COUNT"))); 34 | } 35 | -------------------------------------------------------------------------------- /src/BaseColumns.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2013 Team XBMC 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include 23 | 24 | class CJNIBaseColumns 25 | { 26 | public: 27 | static void PopulateStaticFields(); 28 | 29 | static std::string _ID; 30 | static std::string _COUNT; 31 | 32 | private: 33 | CJNIBaseColumns(); 34 | }; 35 | -------------------------------------------------------------------------------- /src/BitSet.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2013 Team XBMC 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | class CJNIBitSet : public CJNIBase 25 | { 26 | public: 27 | CJNIBitSet(); 28 | CJNIBitSet(int); 29 | CJNIBitSet(const jni::jhobject &object) : CJNIBase(object) {}; 30 | ~CJNIBitSet() {}; 31 | 32 | void flip(int); 33 | void flip(int, int); 34 | void set(int); 35 | void set(int, bool); 36 | void set(int, int); 37 | void set(int, int, bool); 38 | void clear(int); 39 | void clear(int, int); 40 | void clear(); 41 | bool get(int); 42 | CJNIBitSet get(int, int); 43 | int nextSetBit(int); 44 | int nextClearBit(int); 45 | int length(); 46 | bool isEmpty(); 47 | bool intersects(const CJNIBitSet &); 48 | int cardinality(); 49 | void jand(const CJNIBitSet &); 50 | void jor(const CJNIBitSet &); 51 | void jxor(const CJNIBitSet &); 52 | void jandNot(const CJNIBitSet &); 53 | int hashCode(); 54 | int size(); 55 | std::string toString(); 56 | }; 57 | -------------------------------------------------------------------------------- /src/Bitmap.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2013 Team XBMC 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | class CJNIBitmap : public CJNIBase 25 | { 26 | public: 27 | CJNIBitmap() : CJNIBase() {} 28 | CJNIBitmap(const jni::jhobject &object) : CJNIBase(object) {} 29 | ~CJNIBitmap() {} 30 | 31 | enum Config 32 | { 33 | ALPHA_8, 34 | ARGB_4444, 35 | ARGB_8888, 36 | HARDWARE, 37 | RGBA_1010102, 38 | RGBA_F16, 39 | RGB_565, 40 | }; 41 | 42 | static CJNIBitmap createBitmap(int width, int height, CJNIBitmap::Config config); 43 | }; 44 | -------------------------------------------------------------------------------- /src/BitmapDrawable.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Team XBMC 3 | * http://xbmc.org 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with XBMC; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | #include "BitmapDrawable.h" 22 | #include "Bitmap.h" 23 | #include "jutils-details.hpp" 24 | 25 | using namespace jni; 26 | 27 | CJNIBitmapDrawable::CJNIBitmapDrawable() : CJNIDrawable("android/graphics/drawable/BitmapDrawable") 28 | { 29 | m_object = new_object(GetClassName(), "", "()V"); 30 | m_object.setGlobal(); 31 | } 32 | 33 | CJNIBitmap CJNIBitmapDrawable::getBitmap() 34 | { 35 | return call_method(m_object, 36 | "getBitmap", "()Landroid/graphics/Bitmap;"); 37 | } 38 | -------------------------------------------------------------------------------- /src/BitmapDrawable.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2013 Team XBMC 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "Drawable.h" 23 | 24 | class CJNIBitmap; 25 | 26 | class CJNIBitmapDrawable : public CJNIDrawable 27 | { 28 | public: 29 | CJNIBitmapDrawable(); 30 | CJNIBitmapDrawable(const jni::jhobject &object) : CJNIDrawable(object) {}; 31 | // This constructor is deprecated 32 | CJNIBitmapDrawable(const CJNIDrawable &drawable) : CJNIDrawable(drawable.get_raw()) {}; 33 | ~CJNIBitmapDrawable() {}; 34 | 35 | CJNIBitmap getBitmap(); 36 | }; 37 | -------------------------------------------------------------------------------- /src/BitmapFactory.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Christian Browet 3 | * http://xbmc.org 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with XBMC; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | #include "Bitmap.h" 22 | #include "BitmapFactory.h" 23 | #include "jutils-details.hpp" 24 | 25 | using namespace jni; 26 | 27 | const char* CJNIBitmapFactory::m_classname = "android/graphics/BitmapFactory"; 28 | 29 | CJNIBitmap CJNIBitmapFactory::decodeFile(const std::string& pathName) 30 | { 31 | return CJNIBitmap(call_static_method(m_classname, 32 | "decodeFile", "(Ljava/lang/String;)Landroid/graphics/Bitmap;", 33 | jcast(pathName))); 34 | } 35 | -------------------------------------------------------------------------------- /src/BitmapFactory.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2016 Christian Browet 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | #include "Bitmap.h" 25 | 26 | namespace jni 27 | { 28 | 29 | class CJNIBitmapFactory : public CJNIBase 30 | { 31 | public: 32 | CJNIBitmapFactory(const jni::jhobject &object) : CJNIBase(object) {} 33 | 34 | static CJNIBitmap decodeFile(const std::string& pathName); 35 | 36 | protected: 37 | virtual ~CJNIBitmapFactory() {} 38 | 39 | private: 40 | static const char *m_classname; 41 | }; 42 | 43 | } 44 | 45 | -------------------------------------------------------------------------------- /src/BroadcastReceiver.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Team XBMC 3 | * http://xbmc.org 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with XBMC; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | #include "BroadcastReceiver.h" 22 | #include "Intent.h" 23 | #include "Context.h" 24 | #include "Activity.h" 25 | #include "ClassLoader.h" 26 | #include "jutils-details.hpp" 27 | 28 | using namespace jni; 29 | 30 | CJNIBroadcastReceiver *CJNIBroadcastReceiver::m_receiverInstance(NULL); 31 | CJNIBroadcastReceiver::CJNIBroadcastReceiver(const std::string &className) : CJNIBase(className) 32 | { 33 | m_object = new_object(CJNIContext::getClassLoader().loadClass(GetDotClassName(className))); 34 | m_receiverInstance = this; 35 | m_object.setGlobal(); 36 | } 37 | 38 | void CJNIBroadcastReceiver::_onReceive(JNIEnv *env, jobject context, jobject intent) 39 | { 40 | (void)env; 41 | (void)context; 42 | if(m_receiverInstance) 43 | m_receiverInstance->onReceive(CJNIIntent(jhobject::fromJNI(intent))); 44 | } 45 | -------------------------------------------------------------------------------- /src/BroadcastReceiver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2013 Team XBMC 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | class CJNIIntent; 24 | 25 | class CJNIBroadcastReceiver : public CJNIBase 26 | { 27 | public: 28 | static void _onReceive(JNIEnv *env, jobject context, jobject intent); 29 | 30 | protected: 31 | CJNIBroadcastReceiver(const std::string &className); 32 | ~CJNIBroadcastReceiver(){}; 33 | 34 | virtual void onReceive(CJNIIntent intent)=0; 35 | 36 | private: 37 | static CJNIBroadcastReceiver *m_receiverInstance; 38 | }; 39 | -------------------------------------------------------------------------------- /src/Buffer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2013 Team XBMC 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | class CJNIBuffer : public CJNIBase 25 | { 26 | protected: 27 | CJNIBuffer(const jni::jhobject &object) : CJNIBase(object) {}; 28 | ~CJNIBuffer() {}; 29 | 30 | public: 31 | int capacity(); 32 | int position(); 33 | CJNIBuffer position(int newPosition); 34 | int limit(); 35 | CJNIBuffer limit(int newLimit); 36 | CJNIBuffer mark(); 37 | CJNIBuffer reset(); 38 | CJNIBuffer clear(); 39 | CJNIBuffer flip(); 40 | CJNIBuffer rewind(); 41 | int remaining(); 42 | bool hasRemaining(); 43 | 44 | virtual bool isReadOnly(); 45 | virtual bool hasArray(); 46 | //virtual CJNIObject array(); 47 | virtual int arrayOffset(); 48 | virtual bool isDirect(); 49 | }; 50 | -------------------------------------------------------------------------------- /src/Build.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2013 Team XBMC 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | class CJNIBuild 25 | { 26 | public: 27 | static std::string UNKNOWN; 28 | static std::string ID; 29 | static std::string DISPLAY; 30 | static std::string PRODUCT; 31 | static std::string DEVICE; 32 | static std::string BOARD; 33 | // Deprecated in API level 21 34 | static std::string CPU_ABI; 35 | // Deprecated in API level 21 36 | static std::string CPU_ABI2; 37 | static std::string MANUFACTURER; 38 | static std::string BRAND; 39 | static std::string MODEL; 40 | static std::string BOOTLOADER; 41 | // Deprecated in API level 15 42 | static std::string RADIO; 43 | static std::string HARDWARE; 44 | // Deprecated in API level 26 45 | static std::string SERIAL; 46 | static std::string TYPE; 47 | static std::string TAGS; 48 | static std::string FINGERPRINT; 49 | static int64_t TIME; 50 | static std::string USER; 51 | static std::string HOST; 52 | static int SDK_INT; 53 | static std::string getRadioVersion(); 54 | 55 | static void PopulateStaticFields(); 56 | private: 57 | CJNIBuild(); 58 | ~CJNIBuild() {}; 59 | static const char *m_classname; 60 | }; 61 | -------------------------------------------------------------------------------- /src/Bundle.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 Team Kodi 3 | * This file is part of Kodi - https://kodi.tv 4 | * 5 | * SPDX-License-Identifier: GPL-2.0-or-later 6 | * See LICENSES/README.md for more information. 7 | */ 8 | 9 | #include "Bundle.h" 10 | 11 | #include "jutils-details.hpp" 12 | 13 | using namespace jni; 14 | 15 | CJNIArrayList CJNIBundle::getStringArrayList(const std::string& key) 16 | { 17 | return call_method(m_object, "getStringArrayList", 18 | "(Ljava/lang/String;)Ljava/util/ArrayList;", jcast(key)); 19 | } 20 | -------------------------------------------------------------------------------- /src/Bundle.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2022 Team Kodi 4 | * This file is part of Kodi - https://kodi.tv 5 | * 6 | * SPDX-License-Identifier: GPL-2.0-or-later 7 | * See LICENSES/README.md for more information. 8 | */ 9 | 10 | #include "JNIBase.h" 11 | #include "ArrayList.h" 12 | 13 | class CJNIBundle : public CJNIBase 14 | { 15 | public: 16 | CJNIBundle(jni::jhobject const& object) : CJNIBase(object) {}; 17 | ~CJNIBundle() {}; 18 | 19 | CJNIArrayList getStringArrayList(const std::string& key); 20 | }; 21 | -------------------------------------------------------------------------------- /src/Canvas.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 Team Kodi 3 | * http://kodi.tv 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with XBMC; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | #include "Canvas.h" 22 | 23 | #include "Bitmap.h" 24 | #include "jutils-details.hpp" 25 | 26 | using namespace jni; 27 | 28 | static std::string s_className = "android/graphics/Canvas"; 29 | 30 | CJNICanvas::CJNICanvas(const CJNIBitmap& bitmap) : CJNIBase(s_className) 31 | { 32 | m_object = new_object(s_className, "", "(Landroid/graphics/Bitmap;)V", bitmap.get_raw()); 33 | } 34 | 35 | int CJNICanvas::getWidth() 36 | { 37 | return call_method(m_object, "getWidth", "()I"); 38 | } 39 | 40 | int CJNICanvas::getHeight() 41 | { 42 | return call_method(m_object, "getHeight", "()I"); 43 | } 44 | -------------------------------------------------------------------------------- /src/Canvas.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2022 Team Kodi 4 | * http://kodi.tv 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | class CJNIBitmap; 25 | 26 | class CJNICanvas : public CJNIBase 27 | { 28 | public: 29 | explicit CJNICanvas(const jni::jhobject& object) : CJNIBase(object) {} 30 | explicit CJNICanvas(const CJNIBitmap& bitmap); 31 | ~CJNICanvas() {} 32 | 33 | int getWidth(); 34 | int getHeight(); 35 | 36 | private: 37 | CJNICanvas() = delete; 38 | }; 39 | -------------------------------------------------------------------------------- /src/CharSequence.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Team XBMC 3 | * http://xbmc.org 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with XBMC; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | #include "CharSequence.h" 22 | #include "jutils-details.hpp" 23 | 24 | using namespace jni; 25 | 26 | std::string CJNICharSequence::toString() 27 | { 28 | return jcast(call_method(m_object, 29 | "toString", "()Ljava/lang/String;")); 30 | } 31 | -------------------------------------------------------------------------------- /src/CharSequence.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2013 Team XBMC 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | class CJNICharSequence : public CJNIBase 25 | { 26 | public: 27 | CJNICharSequence(const jni::jhobject &object) : CJNIBase(object) {}; 28 | ~CJNICharSequence() {}; 29 | 30 | std::string toString(); 31 | 32 | private: 33 | CJNICharSequence(); 34 | }; 35 | -------------------------------------------------------------------------------- /src/ClassLoader.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Team XBMC 3 | * http://xbmc.org 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with XBMC; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | #include "ClassLoader.h" 22 | #include "jutils-details.hpp" 23 | 24 | using namespace jni; 25 | 26 | jhclass CJNIClassLoader::loadClass(std::string className) 27 | { 28 | return call_method(m_object, 29 | "loadClass", "(Ljava/lang/String;)Ljava/lang/Class;", 30 | jcast(className)); 31 | } 32 | -------------------------------------------------------------------------------- /src/ClassLoader.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2013 Team XBMC 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | class CJNIClassLoader : public CJNIBase 25 | { 26 | public: 27 | CJNIClassLoader(const jni::jhobject &object) : CJNIBase(object) {}; 28 | ~CJNIClassLoader() {}; 29 | 30 | jni::jhclass loadClass(std::string className); 31 | 32 | private: 33 | CJNIClassLoader(); 34 | }; 35 | -------------------------------------------------------------------------------- /src/ContentResolver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2013 Team XBMC 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include 23 | #include 24 | 25 | #include "JNIBase.h" 26 | #include "URIPermission.h" 27 | #include "List.h" 28 | 29 | class CJNICursor; 30 | class CJNIURI; 31 | 32 | class CJNIContentResolver : public CJNIBase 33 | { 34 | public: 35 | CJNIContentResolver(const jni::jhobject &object) : CJNIBase(object) {} 36 | 37 | CJNICursor query(const CJNIURI &uri, const std::vector &projection, const std::string &selection, const std::vector &selectionArgs, const std::string &sortOrder); 38 | void takePersistableUriPermission(const CJNIURI &uri, int modeFlags); 39 | CJNIList getPersistedUriPermissions(); 40 | 41 | static void PopulateStaticFields(); 42 | static std::string SCHEME_CONTENT; 43 | static std::string SCHEME_ANDROID_RESOURCE; 44 | static std::string SCHEME_FILE; 45 | static std::string CURSOR_ITEM_BASE_TYPE; 46 | static std::string CURSOR_DIR_BASE_TYPE; 47 | 48 | private: 49 | CJNIContentResolver(); 50 | }; 51 | -------------------------------------------------------------------------------- /src/DhcpInfo.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Team XBMC 3 | * http://xbmc.org 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with XBMC; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | #include "DhcpInfo.h" 22 | #include "jutils-details.hpp" 23 | 24 | using namespace jni; 25 | 26 | CJNIDhcpInfo::CJNIDhcpInfo(const jhobject &object) : CJNIBase(object) 27 | ,ipAddress( get_field(m_object, "ipAddress")) 28 | ,gateway( get_field(m_object, "gateway")) 29 | ,netmask( get_field(m_object, "netmask")) 30 | ,dns1( get_field(m_object, "dns1")) 31 | ,dns2( get_field(m_object, "dns2")) 32 | ,serverAddress( get_field(m_object, "serverAddress")) 33 | ,leaseDuration( get_field(m_object, "leaseDuration")) 34 | { 35 | } 36 | 37 | std::string CJNIDhcpInfo::toString() 38 | { 39 | return jcast(call_method(m_object, 40 | "toString", "()Ljava/lang/String;")); 41 | } 42 | 43 | int CJNIDhcpInfo::describeContents() 44 | { 45 | return call_method(m_object, 46 | "describeContents", "()I"); 47 | } 48 | -------------------------------------------------------------------------------- /src/DhcpInfo.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2013 Team XBMC 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | class CJNIDhcpInfo : public CJNIBase 25 | { 26 | public: 27 | CJNIDhcpInfo(); 28 | CJNIDhcpInfo(const jni::jhobject &object); 29 | ~CJNIDhcpInfo(){}; 30 | 31 | std::string toString(); 32 | int ipAddress; 33 | int gateway; 34 | int netmask; 35 | int dns1; 36 | int dns2; 37 | int serverAddress; 38 | int leaseDuration; 39 | int describeContents(); 40 | }; 41 | -------------------------------------------------------------------------------- /src/DisplayManager.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Team Kodi 3 | * http://kodi.tv 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with Kodi; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | #include "DisplayManager.h" 22 | 23 | #include "jutils-details.hpp" 24 | 25 | using namespace jni; 26 | 27 | /*************/ 28 | 29 | void CJNIDisplayManager::registerDisplayListener(const jni::jhobject &listener) 30 | { 31 | call_method(m_object, 32 | "registerDisplayListener", "(Landroid/hardware/display/DisplayManager$DisplayListener;Landroid/os/Handler;)V", 33 | listener, jhobject(nullptr)); 34 | } 35 | 36 | void CJNIDisplayManager::unregisterDisplayListener(const jni::jhobject &listener) 37 | { 38 | call_method(m_object, 39 | "unregisterDisplayListener", "(Landroid/hardware/display/DisplayManager$DisplayListener;)V", 40 | listener); 41 | } 42 | -------------------------------------------------------------------------------- /src/DisplayManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2018 Team Kodi 4 | * http://kodi.tv 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Kodi; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | class CJNIDisplayManager : public CJNIBase 25 | { 26 | public: 27 | CJNIDisplayManager(const jni::jhobject &object) : CJNIBase(object) {}; 28 | ~CJNIDisplayManager() {}; 29 | 30 | void registerDisplayListener(const jni::jhobject &listener); 31 | void unregisterDisplayListener(const jni::jhobject &listener); 32 | }; 33 | -------------------------------------------------------------------------------- /src/DisplayMetrics.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2013 Team XBMC 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | class CJNIDisplayMetrics 25 | { 26 | public: 27 | static int DENSITY_DEFAULT; 28 | static int DENSITY_HIGH; 29 | static int DENSITY_LOW; 30 | static int DENSITY_MEDIUM; 31 | static int DENSITY_TV; 32 | static int DENSITY_XHIGH; 33 | static int DENSITY_XXHIGH; 34 | static int DENSITY_XXXHIGH; 35 | 36 | static void PopulateStaticFields(); 37 | 38 | private: 39 | CJNIDisplayMetrics(); 40 | ~CJNIDisplayMetrics() {}; 41 | static const char *m_classname; 42 | }; 43 | -------------------------------------------------------------------------------- /src/Document.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Team XBMC 3 | * http://xbmc.org 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with XBMC; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | #include "Document.h" 22 | #include "jutils-details.hpp" 23 | 24 | using namespace jni; 25 | 26 | std::string CJNIDocument::COLUMN_DISPLAY_NAME; 27 | std::string CJNIDocument::COLUMN_MIME_TYPE; 28 | std::string CJNIDocument::COLUMN_DOCUMENT_ID; 29 | std::string CJNIDocument::COLUMN_SIZE; 30 | std::string CJNIDocument::COLUMN_FLAGS; 31 | std::string CJNIDocument::MIME_TYPE_DIR; 32 | 33 | void CJNIDocument::PopulateStaticFields() 34 | { 35 | if (CJNIBase::GetSDKVersion() >= 19) 36 | { 37 | jhclass c = find_class("android/provider/DocumentsContract$Document"); 38 | CJNIDocument::COLUMN_DISPLAY_NAME = jcast(get_static_field(c,"COLUMN_DISPLAY_NAME")); 39 | CJNIDocument::COLUMN_MIME_TYPE = jcast(get_static_field(c,"COLUMN_MIME_TYPE")); 40 | CJNIDocument::COLUMN_DOCUMENT_ID = jcast(get_static_field(c,"COLUMN_DOCUMENT_ID")); 41 | CJNIDocument::COLUMN_SIZE = jcast(get_static_field(c,"COLUMN_SIZE")); 42 | CJNIDocument::COLUMN_FLAGS = jcast(get_static_field(c,"COLUMN_FLAGS")); 43 | CJNIDocument::MIME_TYPE_DIR = jcast(get_static_field(c,"MIME_TYPE_DIR")); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/Document.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2013 Team XBMC 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | class CJNIURI; 25 | 26 | class CJNIDocument : public CJNIBase 27 | { 28 | public: 29 | static void PopulateStaticFields(); 30 | 31 | static std::string COLUMN_DISPLAY_NAME; 32 | static std::string COLUMN_MIME_TYPE; 33 | static std::string COLUMN_DOCUMENT_ID; 34 | static std::string COLUMN_SIZE; 35 | static std::string COLUMN_FLAGS; 36 | static std::string MIME_TYPE_DIR; 37 | 38 | protected: 39 | CJNIDocument(); 40 | ~CJNIDocument(){} 41 | }; 42 | -------------------------------------------------------------------------------- /src/DocumentsContract.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2013 Team XBMC 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | class CJNIURI; 25 | 26 | class CJNIDocumentsContract : public CJNIBase 27 | { 28 | public: 29 | static void PopulateStaticFields(); 30 | 31 | static std::string getTreeDocumentId (const CJNIURI& documentUri); 32 | static std::string getDocumentId (const CJNIURI& documentUri); 33 | static CJNIURI buildChildDocumentsUriUsingTree (const CJNIURI& treeUri, const std::string& parentDocumentId); 34 | static CJNIURI buildChildDocumentsUri (const std::string& authority, const std::string& parentDocumentId); 35 | static CJNIURI buildDocumentUriUsingTree (const CJNIURI& treeUri, const std::string& parentDocumentId); 36 | 37 | protected: 38 | CJNIDocumentsContract(); 39 | ~CJNIDocumentsContract(){} 40 | }; 41 | -------------------------------------------------------------------------------- /src/Drawable.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 Team Kodi 3 | * http://kodi.tv 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with XBMC; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | #include "Drawable.h" 22 | 23 | #include "Canvas.h" 24 | #include "jutils-details.hpp" 25 | 26 | using namespace jni; 27 | 28 | int CJNIDrawable::getIntrinsicWidth() 29 | { 30 | return call_method(m_object, "getIntrinsicWidth", "()I"); 31 | } 32 | 33 | int CJNIDrawable::getIntrinsicHeight() 34 | { 35 | return call_method(m_object, "getIntrinsicHeight", "()I"); 36 | } 37 | 38 | void CJNIDrawable::setBounds(int left, int top, int right, int bottom) 39 | { 40 | call_method(m_object, "setBounds", "(IIII)V", left, top, right, bottom); 41 | } 42 | 43 | void CJNIDrawable::draw(const CJNICanvas& canvas) 44 | { 45 | call_method(m_object, "draw", "(Landroid/graphics/Canvas;)V", canvas.get_raw()); 46 | } 47 | -------------------------------------------------------------------------------- /src/Drawable.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2013 Team XBMC 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | class CJNICanvas; 25 | 26 | class CJNIDrawable : public CJNIBase 27 | { 28 | public: 29 | CJNIDrawable(); 30 | CJNIDrawable(const jni::jhobject &object) : CJNIBase(object){}; 31 | CJNIDrawable(std::string classname) : CJNIBase(classname){}; 32 | ~CJNIDrawable(){}; 33 | 34 | int getIntrinsicWidth(); 35 | int getIntrinsicHeight(); 36 | void setBounds(int left, int top, int right, int bottom); 37 | void draw(const CJNICanvas& canvas); 38 | }; 39 | -------------------------------------------------------------------------------- /src/Enum.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Team XBMC 3 | * http://xbmc.org 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with XBMC; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | #include "Enum.h" 22 | #include "jutils-details.hpp" 23 | 24 | using namespace jni; 25 | 26 | std::string CJNIEnum::name() 27 | { 28 | return jcast(call_method(m_object, 29 | "name", "()Ljava/lang/String;")); 30 | } 31 | 32 | std::string CJNIEnum::toString() 33 | { 34 | return jcast(call_method(m_object, 35 | "toString", "()Ljava/lang/String;")); 36 | } 37 | bool CJNIEnum::equals(const CJNIEnum &object) 38 | { 39 | return call_method(m_object, 40 | "equals", "(Ljava/lang/Object;)Z", object.get_raw()); 41 | } 42 | -------------------------------------------------------------------------------- /src/Enum.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2013 Team XBMC 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | class CJNIEnum : public CJNIBase 25 | { 26 | public: 27 | CJNIEnum(jni::jhobject const& object) : CJNIBase(object) {}; 28 | ~CJNIEnum() {}; 29 | 30 | virtual std::string name(); 31 | virtual std::string toString(); 32 | virtual bool equals(const CJNIEnum &object); 33 | }; 34 | -------------------------------------------------------------------------------- /src/Environment.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2013 Team XBMC 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | class CJNIFile; 25 | 26 | class CJNIEnvironment : public CJNIBase 27 | { 28 | public: 29 | static void PopulateStaticFields(); 30 | 31 | static std::string DIRECTORY_DCIM; 32 | static std::string DIRECTORY_DOWNLOADS; 33 | static std::string DIRECTORY_MOVIES; 34 | static std::string DIRECTORY_MUSIC; 35 | static std::string DIRECTORY_PICTURES; 36 | 37 | static std::string MEDIA_MOUNTED; 38 | static std::string MEDIA_MOUNTED_READ_ONLY; 39 | 40 | static std::string getExternalStorageState(); 41 | // Deprecated in API level 29 42 | static CJNIFile getExternalStorageDirectory(); 43 | // Deprecated in API level 29 44 | static CJNIFile getExternalStoragePublicDirectory(const std::string &type); 45 | static bool isExternalStorageManager(); 46 | 47 | protected: 48 | CJNIEnvironment(); 49 | ~CJNIEnvironment(){}; 50 | }; 51 | -------------------------------------------------------------------------------- /src/File.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Team XBMC 3 | * http://xbmc.org 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with XBMC; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | #include "File.h" 22 | #include "jutils-details.hpp" 23 | 24 | using namespace jni; 25 | 26 | CJNIFile::CJNIFile(const std::string& pathname) : CJNIBase("java/io/File") 27 | { 28 | m_object = new_object(GetClassName(), "", "(Ljava/lang/String;)V", jcast(pathname)); 29 | m_object.setGlobal(); 30 | } 31 | 32 | bool CJNIFile::exists() 33 | { 34 | return call_method(m_object, "exists", "()Z"); 35 | } 36 | 37 | std::string CJNIFile::getAbsolutePath() 38 | { 39 | return jcast(call_method(m_object, 40 | "getAbsolutePath", "()Ljava/lang/String;")); 41 | } 42 | 43 | int64_t CJNIFile::getUsableSpace() 44 | { 45 | return call_method(m_object, 46 | "getUsableSpace", "()J"); 47 | } 48 | -------------------------------------------------------------------------------- /src/File.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2013 Team XBMC 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | class CJNIFile : public CJNIBase 25 | { 26 | public: 27 | CJNIFile(); 28 | CJNIFile(const jni::jhobject &file) : CJNIBase(file){}; 29 | CJNIFile(const std::string& pathname); 30 | ~CJNIFile(){}; 31 | 32 | bool exists(); 33 | std::string getAbsolutePath(); 34 | int64_t getUsableSpace(); 35 | }; 36 | -------------------------------------------------------------------------------- /src/FileDescriptor.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Christian Browet 3 | * http://xbmc.org 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with XBMC; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | #include "FileDescriptor.h" 22 | #include "jutils-details.hpp" 23 | 24 | using namespace jni; 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/FileDescriptor.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2016 Christian Browet 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | namespace jni 25 | { 26 | 27 | class CJNIFileDescriptor : public CJNIBase 28 | { 29 | public: 30 | CJNIFileDescriptor(const jni::jhobject &object) : CJNIBase(object) {} 31 | 32 | protected: 33 | ~CJNIFileDescriptor(){} 34 | }; 35 | 36 | } 37 | 38 | -------------------------------------------------------------------------------- /src/FileProvider.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 Team Kodi 3 | * This file is part of Kodi - https://kodi.tv 4 | * 5 | * SPDX-License-Identifier: GPL-2.0-or-later 6 | * See LICENSES/README.md for more information. 7 | */ 8 | 9 | #include "FileProvider.h" 10 | 11 | #include "jutils-details.hpp" 12 | 13 | using namespace jni; 14 | 15 | const std::string CJNIFileProvider::m_classname = "androidx/core/content/FileProvider"; 16 | 17 | const CJNIURI CJNIFileProvider::getUriForFile(const CJNIContext& context, const std::string& authority, const CJNIFile& file) 18 | { 19 | const jhclass clazz = CJNIContext::getClassLoader().loadClass(m_classname); 20 | 21 | return call_static_method(clazz, 22 | "getUriForFile", "(Landroid/content/Context;Ljava/lang/String;Ljava/io/File;)Landroid/net/Uri;", 23 | context.get_raw(), jcast(authority), file.get_raw()); 24 | }; 25 | -------------------------------------------------------------------------------- /src/FileProvider.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2024 Team Kodi 4 | * This file is part of Kodi - https://kodi.tv 5 | * 6 | * SPDX-License-Identifier: GPL-2.0-or-later 7 | * See LICENSES/README.md for more information. 8 | */ 9 | 10 | #include "JNIBase.h" 11 | #include "Context.h" 12 | #include "File.h" 13 | #include "URI.h" 14 | 15 | class CJNIFileProvider : public CJNIBase 16 | { 17 | public: 18 | static const CJNIURI getUriForFile(const CJNIContext& context, const std::string& authority, const CJNIFile& file); 19 | 20 | private: 21 | static const std::string m_classname; 22 | }; 23 | -------------------------------------------------------------------------------- /src/HashMap.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Team Kodi 3 | * http://kodi.tv 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with KODI; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | #include "HashMap.h" 22 | #include "jutils-details.hpp" 23 | 24 | using namespace jni; 25 | 26 | CJNIHashMap::CJNIHashMap() 27 | : CJNIBase("java/util/HashMap") 28 | { 29 | m_object = new_object(GetClassName(), "", "(I)V", 1); 30 | m_object.setGlobal(); 31 | } 32 | 33 | jhstring CJNIHashMap::put(const jhstring key, const jhstring value) 34 | { 35 | return call_method(m_object, 36 | "put", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;", 37 | key, value); 38 | } 39 | -------------------------------------------------------------------------------- /src/HashMap.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2018 Team Kodi 4 | * http://kodi.tv 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with KODI; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | namespace jni 25 | { 26 | 27 | class CJNIHashMap : public CJNIBase 28 | { 29 | public: 30 | CJNIHashMap(const jni::jhobject &object) : CJNIBase(object) {} 31 | CJNIHashMap(); 32 | virtual ~CJNIHashMap() {} 33 | 34 | virtual jhstring put(const jhstring key, const jhstring value); 35 | }; 36 | 37 | } 38 | 39 | -------------------------------------------------------------------------------- /src/IBinder.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2016 Christian Browet 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | namespace jni 25 | { 26 | 27 | class CJNIIInterface; 28 | class CJNIParcel; 29 | class CJNIFileDescriptor; 30 | 31 | class CJNIIBinderDeathRecipient : public CJNIBase 32 | { 33 | public: 34 | virtual void binderDied(); 35 | }; 36 | 37 | class CJNIIBinder : public CJNIBase 38 | { 39 | public: 40 | CJNIIBinder() : CJNIBase() {} 41 | CJNIIBinder(const jni::jhobject &object) : CJNIBase(object) {} 42 | virtual ~CJNIIBinder() {} 43 | 44 | static void PopulateStaticFields(); 45 | static int FIRST_CALL_TRANSACTION; 46 | 47 | void dump(const CJNIFileDescriptor& fd, const std::vector& args); 48 | void dumpAsync(const CJNIFileDescriptor& fd, const std::vector& args); 49 | std::string getInterfaceDescriptor(); 50 | bool isBinderAlive(); 51 | void linkToDeath(const CJNIIBinderDeathRecipient& recipient, int flags); 52 | bool pingBinder(); 53 | CJNIIInterface queryLocalInterface(const std::string& descriptor); 54 | bool transact(int code, const CJNIParcel& data, const CJNIParcel& reply, int flags); 55 | bool unlinkToDeath(const CJNIIBinderDeathRecipient& recipient, int flags); 56 | }; 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/IInterface.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Christian Browet 3 | * http://xbmc.org 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with XBMC; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | #include "IInterface.h" 22 | #include "jutils-details.hpp" 23 | 24 | using namespace jni; 25 | 26 | 27 | CJNIIBinder CJNIIInterface::asBinder() 28 | { 29 | return call_method(m_object, 30 | "asBinder", "()Landroid/os/IInterface;"); 31 | } 32 | -------------------------------------------------------------------------------- /src/IInterface.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2016 Christian Browet 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | #include "IBinder.h" 25 | 26 | namespace jni 27 | { 28 | 29 | class CJNIIInterface : public CJNIBase 30 | { 31 | public: 32 | CJNIIInterface(const jni::jhobject &object) : CJNIBase(object) {} 33 | virtual ~CJNIIInterface(){} 34 | 35 | CJNIIBinder asBinder(); 36 | 37 | protected: 38 | }; 39 | 40 | } 41 | 42 | -------------------------------------------------------------------------------- /src/Image.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Chris Browet 3 | * http://xbmc.org 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with XBMC; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | #include "Image.h" 22 | #include "jutils-details.hpp" 23 | 24 | using namespace jni; 25 | 26 | const CJNIByteBuffer CJNIImagePlane::getBuffer() 27 | { 28 | return call_method(m_object, 29 | "getBuffer", "()Ljava/nio/ByteBuffer;"); 30 | } 31 | 32 | int CJNIImagePlane::getPixelStride() 33 | { 34 | return call_method(m_object, 35 | "getPixelStride", "()I"); 36 | } 37 | 38 | int CJNIImagePlane::getRowStride() 39 | { 40 | return call_method(m_object, 41 | "getRowStride", "()I"); 42 | } 43 | 44 | void CJNIImage::close() 45 | { 46 | call_method(m_object, 47 | "close", "()V"); 48 | } 49 | 50 | int CJNIImage::getFormat() 51 | { 52 | return call_method(m_object, 53 | "getFormat", "()I"); 54 | } 55 | 56 | std::vector CJNIImage::getPlanes() 57 | { 58 | return jcast>(call_method(m_object, 59 | "getPlanes", "()[Landroid/media/Image$Plane;")); 60 | } 61 | 62 | int CJNIImage::getHeight() 63 | { 64 | return call_method(m_object, 65 | "getHeight", "()I"); 66 | } 67 | 68 | int CJNIImage::getWidth() 69 | { 70 | return call_method(m_object, 71 | "getWidth", "()I"); 72 | } 73 | -------------------------------------------------------------------------------- /src/Image.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2016 Christian Browet 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | #include "ByteBuffer.h" 25 | 26 | namespace jni 27 | { 28 | 29 | class CJNIImagePlane : public CJNIBase 30 | { 31 | public: 32 | CJNIImagePlane(const jni::jhobject &object) : CJNIBase(object) {} 33 | 34 | const CJNIByteBuffer getBuffer(); 35 | int getPixelStride(); 36 | int getRowStride(); 37 | 38 | protected: 39 | CJNIImagePlane(); 40 | }; 41 | 42 | class CJNIImage : public CJNIBase 43 | { 44 | public: 45 | CJNIImage() : CJNIBase() {} 46 | CJNIImage(const jhobject &object) : CJNIBase(object) {} 47 | ~CJNIImage() {} 48 | 49 | void close(); 50 | int getFormat(); 51 | std::vector getPlanes(); 52 | 53 | int getHeight(); 54 | int getWidth(); 55 | 56 | }; 57 | 58 | } 59 | 60 | -------------------------------------------------------------------------------- /src/InetAddress.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2016 Christian Browet 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | #include 25 | 26 | class CJNIInetAddress : public CJNIBase 27 | { 28 | public: 29 | CJNIInetAddress(const jni::jhobject &object) : CJNIBase(object){} 30 | ~CJNIInetAddress(){} 31 | 32 | static CJNIInetAddress getLocalHost(); 33 | static CJNIInetAddress getLoopbackAddress(); 34 | static CJNIInetAddress getByName(std::string host); 35 | 36 | std::vector getAddress(); 37 | std::string getHostAddress(); 38 | std::string getHostName(); 39 | std::string getCanonicalHostName(); 40 | 41 | bool equals(const CJNIInetAddress &other); 42 | std::string toString() const; 43 | int describeContents() const; 44 | 45 | protected: 46 | CJNIInetAddress(); 47 | static const char *m_classname; 48 | }; 49 | 50 | typedef std::vector CJNIInetAddresss; 51 | -------------------------------------------------------------------------------- /src/InputManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2016 Team XBMC 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include 23 | 24 | #include "JNIBase.h" 25 | #include "View.h" 26 | 27 | class CJNIInputManagerInputDeviceListener : public CJNIBase 28 | { 29 | public: 30 | CJNIInputManagerInputDeviceListener(const jni::jhobject &object) : CJNIBase(object) {}; 31 | ~CJNIInputManagerInputDeviceListener() {}; 32 | 33 | static void _onInputDeviceAdded(JNIEnv *env, jobject context, jint deviceId); 34 | static void _onInputDeviceChanged(JNIEnv *env, jobject context, jint deviceId); 35 | static void _onInputDeviceRemoved(JNIEnv *env, jobject context, jint deviceId); 36 | 37 | protected: 38 | CJNIInputManagerInputDeviceListener(); 39 | 40 | virtual void onInputDeviceAdded(int deviceId) = 0; 41 | virtual void onInputDeviceChanged(int deviceId) = 0; 42 | virtual void onInputDeviceRemoved(int deviceId) = 0; 43 | 44 | private: 45 | static CJNIInputManagerInputDeviceListener *m_listenerInstance; 46 | }; 47 | 48 | class CJNIInputManager : public CJNIBase 49 | { 50 | public: 51 | CJNIInputManager(const jni::jhobject &object) : CJNIBase(object) {}; 52 | ~CJNIInputManager() {}; 53 | 54 | const CJNIViewInputDevice getInputDevice(int id) const; 55 | std::vector getInputDeviceIds() const; 56 | 57 | private: 58 | CJNIInputManager(); 59 | }; 60 | -------------------------------------------------------------------------------- /src/IntentFilter.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Team XBMC 3 | * http://xbmc.org 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with XBMC; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | #include "IntentFilter.h" 22 | #include "jutils-details.hpp" 23 | 24 | using namespace jni; 25 | 26 | CJNIIntentFilter::CJNIIntentFilter() : CJNIBase("android/content/IntentFilter") 27 | { 28 | m_object = new_object(GetClassName()); 29 | } 30 | 31 | CJNIIntentFilter::CJNIIntentFilter(const std::string &action) : CJNIBase("android/content/IntentFilter") 32 | { 33 | m_object = new_object(GetClassName(), 34 | "", "(Ljava/lang/String;)V", 35 | jcast(action)); 36 | } 37 | 38 | void CJNIIntentFilter::addAction(std::string action) 39 | { 40 | call_method(m_object, 41 | "addAction", "(Ljava/lang/String;)V", 42 | jcast(action)); 43 | } 44 | 45 | void CJNIIntentFilter::addDataScheme(std::string scheme) 46 | { 47 | call_method(m_object, 48 | "addDataScheme", "(Ljava/lang/String;)V", 49 | jcast(scheme)); 50 | } 51 | -------------------------------------------------------------------------------- /src/IntentFilter.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2013 Team XBMC 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | class CJNIIntentFilter : public CJNIBase 25 | { 26 | public: 27 | CJNIIntentFilter(); 28 | CJNIIntentFilter(const jni::jhobject &object) : CJNIBase(object) {}; 29 | CJNIIntentFilter(const std::string &action); 30 | ~CJNIIntentFilter() {}; 31 | 32 | void addDataScheme(std::string scheme); 33 | void addAction(std::string action); 34 | }; 35 | -------------------------------------------------------------------------------- /src/Iterator.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Christian Browet 3 | * http://xbmc.org 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with XBMC; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | #include "Iterator.h" 22 | #include "jutils-details.hpp" 23 | 24 | using namespace jni; 25 | 26 | 27 | template 28 | bool CJNIIterator::hasNext() 29 | { 30 | return call_method(m_object, 31 | "hasNext", "()Z"); 32 | } 33 | 34 | template 35 | T CJNIIterator::next() 36 | { 37 | return call_method(m_object, 38 | "next", "()Ljava/lang/Object;"); 39 | } 40 | 41 | template 42 | void CJNIIterator::remove() 43 | { 44 | call_method(m_object, 45 | "remove", "()V"); 46 | } 47 | 48 | namespace jni 49 | { 50 | template class CJNIIterator; 51 | } 52 | -------------------------------------------------------------------------------- /src/Iterator.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2016 Christian Browet 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | namespace jni 25 | { 26 | 27 | template 28 | class CJNIIterator : public CJNIBase 29 | { 30 | public: 31 | CJNIIterator(const jni::jhobject &object) : CJNIBase(object) {} 32 | virtual ~CJNIIterator() {} 33 | 34 | bool hasNext(); 35 | T next(); 36 | void remove(); 37 | }; 38 | 39 | } 40 | 41 | -------------------------------------------------------------------------------- /src/KeyCharacterMap.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Team XBMC 3 | * http://xbmc.org 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with XBMC; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | #include "KeyCharacterMap.h" 22 | #include "jutils-details.hpp" 23 | 24 | using namespace jni; 25 | 26 | CJNIKeyCharacterMap CJNIKeyCharacterMap::load(int deviceId) 27 | { 28 | return (CJNIKeyCharacterMap)call_static_method("android/view/KeyCharacterMap", 29 | "load", "(I)Landroid/view/KeyCharacterMap;", 30 | deviceId); 31 | } 32 | 33 | int CJNIKeyCharacterMap::get(int keyCode, int metaState) 34 | { 35 | return call_method(m_object, 36 | "get", "(II)I", 37 | keyCode, metaState); 38 | } 39 | -------------------------------------------------------------------------------- /src/KeyCharacterMap.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2013 Team XBMC 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | class CJNIURI; 25 | class CJNIKeyCharacterMap : public CJNIBase 26 | { 27 | public: 28 | CJNIKeyCharacterMap(const jni::jhobject &object) : CJNIBase(object) {} 29 | ~CJNIKeyCharacterMap() {} 30 | 31 | static CJNIKeyCharacterMap load(int deviceId); 32 | int get(int keyCode, int metaState); 33 | }; 34 | -------------------------------------------------------------------------------- /src/LinkAddress.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Christian Browet 3 | * http://xbmc.org 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with XBMC; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | #include "LinkAddress.h" 22 | #include "InetAddress.h" 23 | 24 | #include "jutils-details.hpp" 25 | 26 | using namespace jni; 27 | 28 | 29 | CJNIInetAddress CJNILinkAddress::getAddress() 30 | { 31 | return call_method(m_object, 32 | "getAddress", "()Ljava/net/InetAddress;"); 33 | } 34 | 35 | int CJNILinkAddress::getFlags() 36 | { 37 | return call_method(m_object, 38 | "getFlags", "()I"); 39 | } 40 | 41 | int CJNILinkAddress::getPrefixLength() 42 | { 43 | return call_method(m_object, 44 | "getPrefixLength", "()I"); 45 | } 46 | 47 | int CJNILinkAddress::getScope() 48 | { 49 | return call_method(m_object, 50 | "getScope", "()I"); 51 | } 52 | 53 | bool CJNILinkAddress::equals(const CJNILinkAddress& other) 54 | { 55 | return call_method(m_object, 56 | "equals", "(Ljava/lang/Object;)Z", other.get_raw()); 57 | } 58 | 59 | std::string CJNILinkAddress::toString() const 60 | { 61 | return jcast(call_method(m_object, 62 | "toString", "()Ljava/lang/String;")); 63 | } 64 | 65 | int CJNILinkAddress::describeContents() const 66 | { 67 | return call_method(m_object, 68 | "describeContents", "()I"); 69 | } 70 | 71 | -------------------------------------------------------------------------------- /src/LinkAddress.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2016 Christian Browet 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | class CJNIInetAddress; 25 | 26 | class CJNILinkAddress : public CJNIBase 27 | { 28 | public: 29 | CJNILinkAddress(const jni::jhobject &object) : CJNIBase(object){} 30 | ~CJNILinkAddress(){} 31 | 32 | CJNIInetAddress getAddress(); 33 | int getFlags(); 34 | int getPrefixLength(); 35 | int getScope(); 36 | 37 | bool equals(const CJNILinkAddress &other); 38 | std::string toString() const; 39 | int describeContents() const; 40 | 41 | protected: 42 | CJNILinkAddress(); 43 | }; 44 | -------------------------------------------------------------------------------- /src/LinkProperties.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2016 Christian Browet 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | #include "List.h" 25 | 26 | class CJNIRouteInfo; 27 | class CJNILinkAddress; 28 | class CJNIInetAddress; 29 | 30 | class CJNILinkProperties : public CJNIBase 31 | { 32 | public: 33 | CJNILinkProperties(const jni::jhobject &object) : CJNIBase(object){} 34 | ~CJNILinkProperties(){} 35 | 36 | std::string getDomains() const; 37 | std::string getInterfaceName() const; 38 | 39 | CJNIList getRoutes() const; 40 | CJNIList getLinkAddresses() const; 41 | CJNIList getDnsServers() const; 42 | 43 | bool equals(const CJNILinkProperties &other) const; 44 | std::string toString() const; 45 | int describeContents() const; 46 | 47 | protected: 48 | CJNILinkProperties(); 49 | }; 50 | -------------------------------------------------------------------------------- /src/List.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Team XBMC 3 | * http://xbmc.org 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with XBMC; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | #include "List.h" 22 | #include "View.h" 23 | #include "ScanResult.h" 24 | #include "WifiConfiguration.h" 25 | #include "ApplicationInfo.h" 26 | #include "URIPermission.h" 27 | #include "LinkAddress.h" 28 | #include "RouteInfo.h" 29 | #include "InetAddress.h" 30 | #include "StorageVolume.h" 31 | 32 | #include "jutils-details.hpp" 33 | 34 | using namespace jni; 35 | 36 | template 37 | T CJNIList::get(int index) const 38 | { 39 | return (T)call_method(m_object, 40 | "get", "(I)Ljava/lang/Object;", 41 | index); 42 | } 43 | 44 | template 45 | int CJNIList::size() const 46 | { 47 | return m_object.get() ? call_method(m_object, 48 | "size", "()I") : 0; 49 | } 50 | 51 | template class CJNIList; 52 | template class CJNIList; 53 | template class CJNIList; 54 | template class CJNIList; 55 | template class CJNIList; 56 | template class CJNIList; 57 | template class CJNIList; 58 | template class CJNIList; 59 | template class CJNIList; 60 | -------------------------------------------------------------------------------- /src/List.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2013 Team XBMC 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | template 25 | class CJNIList : public CJNIBase 26 | { 27 | public: 28 | CJNIList(const jni::jhobject &object) : CJNIBase(object){}; 29 | ~CJNIList(){}; 30 | 31 | T get(int index) const; 32 | int size() const; 33 | 34 | private: 35 | CJNIList(); 36 | }; 37 | -------------------------------------------------------------------------------- /src/Map.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2016 Christian Browet 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | #include "Set.h" 25 | 26 | namespace jni 27 | { 28 | 29 | template 30 | class CJNIMap : public CJNIBase 31 | { 32 | public: 33 | CJNIMap(const jni::jhobject &object) : CJNIBase(object) {} 34 | virtual ~CJNIMap() {} 35 | 36 | virtual void clear(); 37 | virtual bool containsKey(const K& key); 38 | virtual bool containsValue(const V& value); 39 | virtual bool equals(const CJNIMap& o); 40 | virtual V get(const K& key); 41 | virtual int hashCode(); 42 | virtual bool isEmpty(); 43 | virtual CJNISet keySet() ; 44 | virtual V put(const K& key, const V& value); 45 | virtual V remove(const K& key); 46 | virtual int size(); 47 | }; 48 | 49 | } 50 | 51 | -------------------------------------------------------------------------------- /src/MediaCodecBufferInfo.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Team XBMC 3 | * http://xbmc.org 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with XBMC; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | #include "MediaCodecBufferInfo.h" 22 | #include "Context.h" 23 | #include "ClassLoader.h" 24 | 25 | #include "jutils-details.hpp" 26 | 27 | using namespace jni; 28 | 29 | CJNIMediaCodecBufferInfo::CJNIMediaCodecBufferInfo() : CJNIBase("android/media/MediaCodec$BufferInfo") 30 | { 31 | m_object = new_object(GetClassName(), "", "()V"); 32 | m_object.setGlobal(); 33 | } 34 | 35 | void CJNIMediaCodecBufferInfo::set(int newOffset, int newSize, int64_t newTimeUs, int newFlags) 36 | { 37 | call_method(m_object, 38 | "set", "(IIJI)V", 39 | newOffset, newSize, newTimeUs, newFlags); 40 | } 41 | 42 | int CJNIMediaCodecBufferInfo::offset() const 43 | { 44 | return get_field(m_object, "offset"); 45 | } 46 | 47 | int CJNIMediaCodecBufferInfo::size() const 48 | { 49 | return get_field(m_object, "size"); 50 | } 51 | 52 | int64_t CJNIMediaCodecBufferInfo::presentationTimeUs() const 53 | { 54 | return get_field(m_object, "presentationTimeUs"); 55 | } 56 | 57 | int CJNIMediaCodecBufferInfo::flags() const 58 | { 59 | return get_field(m_object, "flags"); 60 | } 61 | -------------------------------------------------------------------------------- /src/MediaCodecBufferInfo.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2013 Team XBMC 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | class CJNIMediaCodecBufferInfo : public CJNIBase 25 | { 26 | public: 27 | CJNIMediaCodecBufferInfo(); 28 | //~CJNIMediaCodecBufferInfo() {}; 29 | 30 | void set(int newOffset, int newSize, int64_t newTimeUs, int newFlags); 31 | int offset() const; 32 | int size() const; 33 | int64_t presentationTimeUs() const; 34 | int flags() const; 35 | }; 36 | -------------------------------------------------------------------------------- /src/MediaCodecCryptoInfo.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2013 Team XBMC 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include 23 | 24 | #include "JNIBase.h" 25 | #include "MediaCodecCryptoInfoPattern.h" 26 | 27 | class CJNIMediaCodecCryptoInfo : public CJNIBase 28 | { 29 | public: 30 | CJNIMediaCodecCryptoInfo(); 31 | CJNIMediaCodecCryptoInfo(const jni::jhobject &object) : CJNIBase(object) {}; 32 | //~CJNIMediaCodecCryptoInfo() {}; 33 | 34 | int numSubSamples() const; 35 | std::vector numBytesOfClearData() const; 36 | std::vector numBytesOfEncryptedData() const; 37 | std::vector key() const; 38 | std::vector iv() const; 39 | int mode() const; 40 | void set(int newNumSubSamples, 41 | const std::vector &newNumBytesOfClearData, 42 | const std::vector &newNumBytesOfEncryptedData, 43 | const std::vector &newKey, 44 | const std::vector &newIV, 45 | int newMode); 46 | void setPattern(const CJNIMediaCodecCryptoInfoPattern &pattern); 47 | }; 48 | -------------------------------------------------------------------------------- /src/MediaCodecCryptoInfoPattern.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 Team Kodi 3 | * http://kodi.tv 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with Kodi; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | #include "jutils-details.hpp" 22 | #include "MediaCodecCryptoInfoPattern.h" 23 | 24 | using namespace jni; 25 | 26 | CJNIMediaCodecCryptoInfoPattern::CJNIMediaCodecCryptoInfoPattern(int blocksToEncrypt, 27 | int blocksToSkip) 28 | : CJNIBase("android/media/MediaCodec$CryptoInfo$Pattern") 29 | { 30 | if(GetSDKVersion() >= 24) 31 | { 32 | m_object = new_object(GetClassName(), "", "(II)V", blocksToEncrypt, blocksToSkip); 33 | m_object.setGlobal(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/MediaCodecCryptoInfoPattern.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 Team Kodi 3 | * http://kodi.tv 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with Kodi; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | #pragma once 21 | 22 | #include "JNIBase.h" 23 | 24 | class CJNIMediaCodecCryptoInfoPattern : public CJNIBase 25 | { 26 | public: 27 | CJNIMediaCodecCryptoInfoPattern(int blocksToEncrypt, int blocksToSkip); 28 | CJNIMediaCodecCryptoInfoPattern(const jni::jhobject &object) : CJNIBase(object) {} 29 | ~CJNIMediaCodecCryptoInfoPattern() {} 30 | }; 31 | -------------------------------------------------------------------------------- /src/MediaCodecList.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2013 Team XBMC 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | #include "MediaCodecInfo.h" 24 | 25 | class CJNIMediaCodecList : public CJNIBase 26 | { 27 | public: 28 | CJNIMediaCodecList(const jni::jhobject &object) : CJNIBase(object) {}; 29 | CJNIMediaCodecList(int kind); 30 | 31 | static void PopulateStaticFields(); 32 | 33 | static int ALL_CODECS; 34 | static int REGULAR_CODECS; 35 | 36 | // Deprecated in API level 21 37 | static int getCodecCount(); 38 | // Deprecated in API level 21 39 | static const CJNIMediaCodecInfo getCodecInfoAt(int index); 40 | std::vector getCodecInfos(); 41 | 42 | private: 43 | CJNIMediaCodecList(); 44 | 45 | static const char *m_classname; 46 | }; 47 | 48 | using CJNIMediaCodecInfos = std::vector; 49 | 50 | -------------------------------------------------------------------------------- /src/MediaCrypto.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2013 Team XBMC 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | class CJNIUUID; 25 | 26 | class CJNIMediaCrypto : public CJNIBase 27 | { 28 | public: 29 | CJNIMediaCrypto(const jni::jhobject &object) : CJNIBase(object) {}; 30 | CJNIMediaCrypto(const CJNIUUID& uuid, const std::vector& initData); 31 | ~CJNIMediaCrypto() {}; 32 | 33 | void setMediaDrmSession(const std::vector & sessionId); 34 | bool requiresSecureDecoderComponent(const std::string& mime); 35 | void release(); 36 | }; 37 | -------------------------------------------------------------------------------- /src/MediaDrmCryptoSession.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2018 Team Kodi 4 | * http://kodi.tv 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with KODI; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | class CJNIMediaDrmCryptoSession : public CJNIBase 25 | { 26 | public: 27 | CJNIMediaDrmCryptoSession(const jni::jhobject &object) : CJNIBase(object) {}; 28 | ~CJNIMediaDrmCryptoSession() {}; 29 | 30 | std::vector decrypt(const std::vector &keyid, const std::vector &input, const std::vector &iv) const; 31 | std::vector encrypt(const std::vector &keyid, const std::vector &input, const std::vector &iv) const; 32 | 33 | std::vector sign(const std::vector &keyid, const std::vector &message) const; 34 | bool verify(const std::vector &keyid, const std::vector &message, const std::vector &signature) const; 35 | }; 36 | 37 | -------------------------------------------------------------------------------- /src/MediaDrmKeyRequest.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Team Kodi 3 | * http://kodi.tv 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with KODI; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | #include "MediaDrmKeyRequest.h" 22 | #include "jutils-details.hpp" 23 | 24 | using namespace jni; 25 | 26 | CJNIMediaDrmKeyRequest::CJNIMediaDrmKeyRequest() 27 | : CJNIBase("android/media/MediaDrm$KeyRequest") 28 | { 29 | m_object = new_object(GetClassName(), "", "()V"); 30 | m_object.setGlobal(); 31 | } 32 | 33 | std::vector CJNIMediaDrmKeyRequest::getData() const 34 | { 35 | JNIEnv *env = xbmc_jnienv(); 36 | jhbyteArray array = call_method(m_object, 37 | "getData", "()[B"); 38 | 39 | std::vector result; 40 | 41 | if (!env->ExceptionCheck()) 42 | { 43 | jsize size = env->GetArrayLength(array.get()); 44 | result.resize(size); 45 | env->GetByteArrayRegion(array.get(), 0, size, (jbyte*)result.data()); 46 | } 47 | 48 | return result; 49 | } 50 | 51 | int CJNIMediaDrmKeyRequest::getRequestType() const 52 | { 53 | return call_method(m_object, "getRequestType", "()I"); 54 | } 55 | -------------------------------------------------------------------------------- /src/MediaDrmKeyRequest.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2018 Team Kodi 4 | * http://kodi.tv 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with KODI; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | class CJNIMediaDrmKeyRequest : public CJNIBase 25 | { 26 | public: 27 | CJNIMediaDrmKeyRequest(); 28 | CJNIMediaDrmKeyRequest(const jni::jhobject &object) : CJNIBase(object) {}; 29 | 30 | std::vector getData() const; 31 | int getRequestType() const; 32 | }; 33 | 34 | -------------------------------------------------------------------------------- /src/MediaDrmOnEventListener.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2018 XBMC Foundation 4 | * http://kodi.tv 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with KODI; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | class CJNIMediaDrm; 25 | class CJNIClassLoader; 26 | 27 | class CJNIMediaDrmOnEventListener : public CJNIBase, public CJNIInterfaceImplem 28 | { 29 | public: 30 | CJNIMediaDrmOnEventListener(CJNIClassLoader &loader); 31 | explicit CJNIMediaDrmOnEventListener(const jni::jhobject &object) : CJNIBase(object) {} 32 | virtual ~CJNIMediaDrmOnEventListener(); 33 | 34 | static void RegisterNatives(JNIEnv* env); 35 | 36 | public: 37 | virtual void onEvent(const CJNIMediaDrm &mediaDrm, const std::vector &sessionId, int event, int extra, const std::vector &data) = 0; 38 | 39 | protected: 40 | static void _onEvent(JNIEnv* env, jobject thiz, jobject mediaDrm, jbyteArray sessionId, jint event, jint extra, jbyteArray data); 41 | private: 42 | jni::jhclass m_class; 43 | }; 44 | 45 | -------------------------------------------------------------------------------- /src/MediaDrmProvisionRequest.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Team Kodi 3 | * http://kodi.tv 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with KODI; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | #include "MediaDrmProvisionRequest.h" 22 | #include "jutils-details.hpp" 23 | 24 | using namespace jni; 25 | 26 | CJNIMediaDrmProvisionRequest::CJNIMediaDrmProvisionRequest() 27 | : CJNIBase("android/media/MediaDrm$ProvisionRequest") 28 | { 29 | m_object = new_object(GetClassName(), "", "()V"); 30 | m_object.setGlobal(); 31 | } 32 | 33 | std::vector CJNIMediaDrmProvisionRequest::getData() const 34 | { 35 | JNIEnv *env = xbmc_jnienv(); 36 | jhbyteArray array = call_method(m_object, 37 | "getData", "()[B"); 38 | 39 | std::vector result; 40 | 41 | if (!env->ExceptionCheck()) 42 | { 43 | jsize size = env->GetArrayLength(array.get()); 44 | result.resize(size); 45 | env->GetByteArrayRegion(array.get(), 0, size, (jbyte*)result.data()); 46 | } 47 | 48 | return result; 49 | } 50 | 51 | std::string CJNIMediaDrmProvisionRequest::getDefaultUrl() const 52 | { 53 | return jcast(call_method(m_object, "getDefaultUrl", "()Ljava/lang/String;")); 54 | } 55 | -------------------------------------------------------------------------------- /src/MediaDrmProvisionRequest.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2018 Team Kodi 4 | * http://kodi.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with KODI; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | class CJNIMediaDrmProvisionRequest : public CJNIBase 25 | { 26 | public: 27 | CJNIMediaDrmProvisionRequest(); 28 | CJNIMediaDrmProvisionRequest(const jni::jhobject &object) : CJNIBase(object) {}; 29 | 30 | std::vector getData() const; 31 | std::string getDefaultUrl() const; 32 | }; 33 | 34 | -------------------------------------------------------------------------------- /src/MediaRouteSelector.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Team Kodi 3 | * http://kodi.tv 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with Kodi; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | #include "MediaRouteSelector.h" 22 | 23 | #include "jutils-details.hpp" 24 | 25 | using namespace jni; 26 | 27 | /*************/ 28 | 29 | CJNIMediaRouteSelector::CJNIMediaRouteSelector() 30 | : CJNIBase("android/support/v7/media/MediaRouteSelector") 31 | { 32 | m_object = new_object(GetClassName()); 33 | m_object.setGlobal(); 34 | } 35 | -------------------------------------------------------------------------------- /src/MediaRouteSelector.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2018 Team Kodi 4 | * http://kodi.tv 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Kodi; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | class CJNIMediaRouteSelector : public CJNIBase 25 | { 26 | public: 27 | CJNIMediaRouteSelector(); 28 | ~CJNIMediaRouteSelector() {}; 29 | }; 30 | -------------------------------------------------------------------------------- /src/MediaRouter.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Team Kodi 3 | * http://kodi.tv 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with Kodi; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | #include "MediaRouter.h" 22 | 23 | #include "MediaRouteSelector.h" 24 | #include "Context.h" 25 | 26 | #include "jutils-details.hpp" 27 | 28 | using namespace jni; 29 | 30 | /*************/ 31 | 32 | void CJNIMediaRouter::addCallback(const CJNIMediaRouteSelector &selector, const jni::jhobject &callback) 33 | { 34 | call_method(m_object, 35 | "addCallback", "(Landroid/support/v7/media/MediaRouteSelector;Landroid/support/v7/media/MediaRouter$Callback;)V", 36 | selector.get_raw(), callback); 37 | } 38 | 39 | CJNIMediaRouter CJNIMediaRouter::getInstance(const CJNIContext &context) 40 | { 41 | return call_static_method("android/support/v7/media/MediaRouter", 42 | "getInstance", "(Ljava/lang/String;)Landroid/content/Context;", context.get_raw()); 43 | } 44 | -------------------------------------------------------------------------------- /src/MediaRouter.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2018 Team Kodi 4 | * http://kodi.tv 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Kodi; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | class CJNIMediaRouteSelector; 25 | class CJNIContext; 26 | 27 | class CJNIMediaRouter : public CJNIBase 28 | { 29 | public: 30 | CJNIMediaRouter(const jni::jhobject &object) : CJNIBase(object) {}; 31 | ~CJNIMediaRouter() {}; 32 | 33 | void addCallback(const CJNIMediaRouteSelector &selector, const jni::jhobject &callback); 34 | static CJNIMediaRouter getInstance(const CJNIContext &context); 35 | }; 36 | -------------------------------------------------------------------------------- /src/MediaStore.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2013 Team XBMC 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | #include "BaseColumns.h" 24 | 25 | class CJNIMediaStoreMediaColumns : public CJNIBaseColumns 26 | { 27 | public: 28 | static void PopulateStaticFields(); 29 | 30 | static std::string DATA; 31 | static std::string SIZE; 32 | static std::string DISPLAY_NAME; 33 | static std::string TITLE; 34 | static std::string DATE_ADDED; 35 | static std::string DATE_MODIFIED; 36 | static std::string MIME_TYPE; 37 | 38 | private: 39 | CJNIMediaStoreMediaColumns(); 40 | }; 41 | 42 | class CJNIMediaStore : public CJNIBase 43 | { 44 | public: 45 | CJNIMediaStore(const jni::jhobject &object) : CJNIBase(object) {}; 46 | ~CJNIMediaStore() {}; 47 | 48 | static void PopulateStaticFields(); 49 | 50 | static std::string EXTRA_MEDIA_FOCUS; 51 | static std::string EXTRA_MEDIA_ALBUM; 52 | static std::string EXTRA_MEDIA_ARTIST; 53 | static std::string EXTRA_MEDIA_TITLE; 54 | }; 55 | -------------------------------------------------------------------------------- /src/MediaSync.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2016 Chris Browet 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include 23 | 24 | #include "JNIBase.h" 25 | #include "ByteBuffer.h" 26 | #include "MediaTimestamp.h" 27 | #include "PlaybackParams.h" 28 | #include "AudioTrack.h" 29 | 30 | namespace jni 31 | { 32 | 33 | class CJNIMediaSync : public CJNIBase 34 | { 35 | public: 36 | static int MEDIASYNC_ERROR_AUDIOTRACK_FAIL; 37 | static int MEDIASYNC_ERROR_SURFACE_FAIL; 38 | static void PopulateStaticFields(); 39 | 40 | CJNIMediaSync(); 41 | void flush(); 42 | void release(); 43 | 44 | CJNIMediaTimestamp getTimestamp(); 45 | 46 | void setAudioTrack(const CJNIAudioTrack& audioTrack); 47 | void queueAudio(uint8_t* audioData, int sizeInBytes, int bufferId, int64_t presentationTimeUs); 48 | void queueAudio(const CJNIByteBuffer& audioData, int bufferId, int64_t presentationTimeUs); 49 | 50 | CJNIPlaybackParams getPlaybackParams(); 51 | void setPlaybackParams(const CJNIPlaybackParams& params); 52 | 53 | protected: 54 | }; 55 | 56 | } 57 | 58 | -------------------------------------------------------------------------------- /src/MediaTimestamp.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Chris Browet 3 | * http://xbmc.org 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with XBMC; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | #include "MediaTimestamp.h" 22 | #include "jutils-details.hpp" 23 | 24 | using namespace jni; 25 | 26 | CJNIMediaTimestamp::CJNIMediaTimestamp() 27 | : CJNIBase("android.media.MediaTimestamp") 28 | { 29 | m_object = new_object(GetClassName()); 30 | m_object.setGlobal(); 31 | } 32 | 33 | CJNIMediaTimestamp::CJNIMediaTimestamp(const jni::jhobject& object) 34 | : CJNIBase(object) 35 | { 36 | } 37 | 38 | int64_t CJNIMediaTimestamp::getAnchorMediaTimeUs() 39 | { 40 | return call_method(m_object, "getAnchorMediaTimeUs", "()J"); 41 | } 42 | 43 | int64_t CJNIMediaTimestamp::getAnchorSytemNanoTime() 44 | { 45 | return call_method(m_object, "getAnchorSytemNanoTime", "()J"); 46 | } 47 | 48 | float CJNIMediaTimestamp::getMediaClockRate() 49 | { 50 | return call_method(m_object, "getMediaClockRate", "()F"); 51 | } 52 | 53 | -------------------------------------------------------------------------------- /src/MediaTimestamp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2016 Chris Browet 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | namespace jni 25 | { 26 | 27 | class CJNIMediaTimestamp : public CJNIBase 28 | { 29 | public: 30 | CJNIMediaTimestamp(); 31 | CJNIMediaTimestamp(const jni::jhobject &object); 32 | 33 | int64_t getAnchorMediaTimeUs(); 34 | // Deprecated in API level 29 35 | int64_t getAnchorSytemNanoTime(); 36 | float getMediaClockRate(); 37 | }; 38 | 39 | } 40 | 41 | -------------------------------------------------------------------------------- /src/Network.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Christian Browet 3 | * http://xbmc.org 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with XBMC; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | #include "Network.h" 22 | #include "jutils-details.hpp" 23 | 24 | using namespace jni; 25 | 26 | bool CJNINetwork::equals(const CJNINetwork& other) const 27 | { 28 | return call_method(m_object, 29 | "equals", "(Ljava/lang/Object;)Z", other.get_raw()); 30 | } 31 | 32 | std::string CJNINetwork::toString() const 33 | { 34 | return jcast(call_method(m_object, 35 | "toString", "()Ljava/lang/String;")); 36 | } 37 | 38 | int CJNINetwork::describeContents() const 39 | { 40 | return call_method(m_object, 41 | "describeContents", "()I"); 42 | } 43 | 44 | -------------------------------------------------------------------------------- /src/Network.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2016 Christian Browet 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | class CJNINetwork : public CJNIBase 25 | { 26 | public: 27 | CJNINetwork(const jni::jhobject &object) : CJNIBase(object){} 28 | ~CJNINetwork(){} 29 | 30 | bool equals(const CJNINetwork &other) const; 31 | std::string toString() const; 32 | int describeContents() const; 33 | 34 | protected: 35 | CJNINetwork(); 36 | }; 37 | 38 | typedef std::vector CJNINetworks; 39 | -------------------------------------------------------------------------------- /src/NetworkInterface.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2016 Christian Browet 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | class CJNIInetAddress; 25 | 26 | class CJNINetworkInterface : public CJNIBase 27 | { 28 | public: 29 | CJNINetworkInterface(const jni::jhobject &object) : CJNIBase(object){} 30 | ~CJNINetworkInterface(){} 31 | 32 | static CJNINetworkInterface getByName(const std::string& name); 33 | static CJNINetworkInterface getByIndex(int index); 34 | static CJNINetworkInterface getByInetAddress(const CJNIInetAddress& addr); 35 | 36 | std::string getName() const; 37 | std::string getDisplayName() const; 38 | std::vector getHardwareAddress() const; 39 | int getIndex() const; 40 | int getMTU() const; 41 | 42 | bool isLoopback() const; 43 | bool isPointToPoint() const; 44 | bool isUp() const; 45 | bool isVirtual() const; 46 | bool supportsMulticast() const; 47 | 48 | bool equals(const CJNINetworkInterface &other) const; 49 | std::string toString() const; 50 | 51 | protected: 52 | CJNINetworkInterface(); 53 | static const char *m_classname; 54 | }; 55 | 56 | typedef std::vector CJNINetworkInterfaces; 57 | -------------------------------------------------------------------------------- /src/NsdServiceInfo.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2016 Christian Browet 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | #include "InetAddress.h" 25 | #include "Parcel.h" 26 | #include "Map.h" 27 | 28 | namespace jni 29 | { 30 | 31 | class CJNINsdServiceInfo : public CJNIBase 32 | { 33 | public: 34 | CJNINsdServiceInfo(); 35 | CJNINsdServiceInfo(const jni::jhobject &object) : CJNIBase(object) {} 36 | virtual ~CJNINsdServiceInfo() {} 37 | 38 | int describeContents() const; 39 | CJNIMap getAttributes() const; 40 | // Deprecated in API level 34 41 | CJNIInetAddress getHost() const; 42 | int getPort() const; 43 | std::string getServiceName() const; 44 | std::string getServiceType() const; 45 | void removeAttribute(const std::string& key); 46 | void setAttribute(const std::string& key, const std::string& value); 47 | // Deprecated in API level 34 48 | void setHost(const CJNIInetAddress& s); 49 | void setPort(int p); 50 | void setServiceName(const std::string& s); 51 | void setServiceType(const std::string& s); 52 | std::string toString() const; 53 | void writeToParcel(const CJNIParcel& dest, int flags); 54 | }; 55 | 56 | } 57 | 58 | -------------------------------------------------------------------------------- /src/Os.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Team XBMC 3 | * http://xbmc.org 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with XBMC; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | #include "Os.h" 22 | 23 | #include "jutils-details.hpp" 24 | 25 | using namespace jni; 26 | 27 | /************************************************************************/ 28 | /************************************************************************/ 29 | void CJNIOsVibrator::cancel() const 30 | { 31 | call_method(m_object, 32 | "cancel", "()V"); 33 | } 34 | 35 | bool CJNIOsVibrator::hasVibrator() const 36 | { 37 | return call_method(m_object, 38 | "hasVibrator", "()Z"); 39 | } 40 | 41 | void CJNIOsVibrator::vibrate(std::vector pattern, int repeat) const 42 | { 43 | //! @todo implement 44 | /* 45 | call_method(m_object, 46 | "vibrate", "([JI)F", 47 | jcast(pattern), repeat); 48 | */ 49 | } 50 | 51 | void CJNIOsVibrator::vibrate(int64_t milliseconds) const 52 | { 53 | call_method(m_object, 54 | "vibrate", "(J)V", 55 | milliseconds); 56 | } 57 | -------------------------------------------------------------------------------- /src/Os.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2016 Team XBMC 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include 23 | 24 | #include "JNIBase.h" 25 | 26 | class CJNIOsVibrator : public CJNIBase 27 | { 28 | public: 29 | CJNIOsVibrator(const jni::jhobject &object) : CJNIBase(object) {}; 30 | ~CJNIOsVibrator() {}; 31 | 32 | void cancel() const; 33 | bool hasVibrator() const; 34 | void vibrate(std::vector pattern, int repeat) const; 35 | // Deprecated in API level 26 36 | void vibrate(int64_t milliseconds) const; 37 | 38 | private: 39 | CJNIOsVibrator(); 40 | }; 41 | -------------------------------------------------------------------------------- /src/PackageItemInfo.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Team XBMC 3 | * http://xbmc.org 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with XBMC; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | #include "PackageItemInfo.h" 22 | #include "jutils-details.hpp" 23 | 24 | using namespace jni; 25 | const char *CJNIPackageItemInfo::m_classname = "android/content/pm/PackageItemInfo"; 26 | 27 | CJNIPackageItemInfo::CJNIPackageItemInfo(const jhobject &object) : CJNIBase(object) 28 | ,icon( get_field(m_object, "icon")) 29 | { 30 | } 31 | -------------------------------------------------------------------------------- /src/PackageItemInfo.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2013 Team XBMC 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | class CJNIPackageItemInfo : public CJNIBase 25 | { 26 | public: 27 | CJNIPackageItemInfo(const jni::jhobject &object); 28 | 29 | int icon; 30 | 31 | protected: 32 | CJNIPackageItemInfo(); 33 | ~CJNIPackageItemInfo() {}; 34 | static const char *m_classname; 35 | 36 | }; 37 | -------------------------------------------------------------------------------- /src/Parcel.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Christian Browet 3 | * http://xbmc.org 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with XBMC; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | #include "Parcel.h" 22 | #include "jutils-details.hpp" 23 | 24 | using namespace jni; 25 | 26 | 27 | 28 | 29 | CJNIParcel CJNIParcel::obtain() 30 | { 31 | return call_static_method("android/os/Parcel", 32 | "obtain", "()Landroid/os/Parcel;"); 33 | } 34 | 35 | void CJNIParcel::recycle() 36 | { 37 | call_method(m_object, 38 | "recycle", "()V"); 39 | } 40 | 41 | void CJNIParcel::writeInterfaceToken(const std::string& interfaceName) 42 | { 43 | call_method(m_object, 44 | "writeInterfaceToken", "(Ljava/lang/String;)V", 45 | jcast(interfaceName)); 46 | } 47 | 48 | void CJNIParcel::writeString(const std::string& val) 49 | { 50 | call_method(m_object, 51 | "writeString", "(Ljava/lang/String;)V", 52 | jcast(val)); 53 | } 54 | 55 | std::string CJNIParcel::readString() 56 | { 57 | return jcast(call_method(m_object, 58 | "readString", "()Ljava/lang/String;")); 59 | } 60 | -------------------------------------------------------------------------------- /src/Parcel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2016 Christian Browet 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | namespace jni 25 | { 26 | 27 | class CJNIParcel : public CJNIBase 28 | { 29 | public: 30 | CJNIParcel(const jni::jhobject &object) : CJNIBase(object) {} 31 | virtual ~CJNIParcel() {} 32 | 33 | static CJNIParcel obtain(); 34 | void recycle(); 35 | 36 | void writeInterfaceToken(const std::string& interfaceName); 37 | void writeString(const std::string& val); 38 | 39 | std::string readString(); 40 | }; 41 | 42 | } 43 | 44 | -------------------------------------------------------------------------------- /src/PendingIntent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2017 Christian Browet 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | class CJNIContext; 25 | class CJNIIntent; 26 | 27 | namespace jni 28 | { 29 | 30 | class CJNIPendingIntent : public CJNIBase 31 | { 32 | public: 33 | CJNIPendingIntent(); 34 | CJNIPendingIntent(const jni::jhobject &object) : CJNIBase(object) {} 35 | virtual ~CJNIPendingIntent() {} 36 | 37 | bool equals(const CJNIPendingIntent &other); 38 | std::string toString() const; 39 | int describeContents() const; 40 | 41 | static CJNIPendingIntent getActivity(const CJNIContext& context, int requestCode, const CJNIIntent& intent, int flags); 42 | }; 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/PlaybackParams.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Chris Browet 3 | * http://xbmc.org 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with XBMC; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | #include "PlaybackParams.h" 22 | #include "jutils-details.hpp" 23 | 24 | using namespace jni; 25 | 26 | CJNIPlaybackParams::CJNIPlaybackParams() 27 | : CJNIBase("android/media/PlaybackParams") 28 | { 29 | m_object = new_object(GetClassName()); 30 | 31 | JNIEnv* jenv = xbmc_jnienv(); 32 | jthrowable exception = jenv->ExceptionOccurred(); 33 | if (exception) 34 | { 35 | jenv->ExceptionClear(); 36 | jhclass excClass = find_class(jenv, "java/lang/Throwable"); 37 | jmethodID toStrMethod = get_method_id(jenv, excClass, "toString", "()Ljava/lang/String;"); 38 | jhstring msg = call_method(exception, toStrMethod); 39 | throw std::invalid_argument(jcast(msg)); 40 | } 41 | m_object.setGlobal(); 42 | } 43 | 44 | CJNIPlaybackParams::CJNIPlaybackParams(const jhobject& object) 45 | : CJNIBase(object) 46 | { 47 | } 48 | 49 | CJNIPlaybackParams CJNIPlaybackParams::setSpeed(float speed) 50 | { 51 | return call_method(m_object, 52 | "setSpeed", "(F)Landroid/media/PlaybackParams;", speed); 53 | } 54 | 55 | float CJNIPlaybackParams::getSpeed() 56 | { 57 | return call_method(m_object, 58 | "getSpeed", "()F"); 59 | } 60 | 61 | -------------------------------------------------------------------------------- /src/PlaybackParams.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2016 Chris Browet 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | #include 24 | 25 | namespace jni 26 | { 27 | 28 | class CJNIPlaybackParams: public CJNIBase 29 | { 30 | public: 31 | CJNIPlaybackParams(); 32 | CJNIPlaybackParams(const jni::jhobject &object); 33 | 34 | CJNIPlaybackParams setSpeed(float speed); 35 | float getSpeed(); 36 | }; 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/PowerManager.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Team XBMC 3 | * http://xbmc.org 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with XBMC; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | #include "PowerManager.h" 22 | #include "WakeLock.h" 23 | #include "jutils-details.hpp" 24 | 25 | using namespace jni; 26 | 27 | int CJNIPowerManager::FULL_WAKE_LOCK(0); 28 | int CJNIPowerManager::SCREEN_BRIGHT_WAKE_LOCK(0xa); 29 | int CJNIPowerManager::ON_AFTER_RELEASE(0x20000000); 30 | 31 | void CJNIPowerManager::PopulateStaticFields() 32 | { 33 | jhclass clazz = find_class("android/os/PowerManager"); 34 | FULL_WAKE_LOCK = (get_static_field(clazz, "FULL_WAKE_LOCK")); 35 | SCREEN_BRIGHT_WAKE_LOCK = (get_static_field(clazz, "SCREEN_BRIGHT_WAKE_LOCK")); 36 | ON_AFTER_RELEASE = (get_static_field(clazz, "ON_AFTER_RELEASE")); 37 | } 38 | 39 | CJNIWakeLock CJNIPowerManager::newWakeLock(int levelAndFlags, const std::string &tag) 40 | { 41 | return call_method(m_object, 42 | "newWakeLock", "(ILjava/lang/String;)Landroid/os/PowerManager$WakeLock;", 43 | levelAndFlags, jcast(tag)); 44 | } 45 | 46 | void CJNIPowerManager::goToSleep(int64_t timestamp) 47 | { 48 | call_method(m_object, 49 | "goToSleep", "(J)V", 50 | (jlong)timestamp); 51 | } 52 | 53 | void CJNIPowerManager::reboot(const std::string &reason) 54 | { 55 | call_method(m_object, 56 | "reboot", "(Ljava/lang/String;)V", 57 | jcast(reason)); 58 | } 59 | -------------------------------------------------------------------------------- /src/PowerManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2013 Team XBMC 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | class CJNIWakeLock; 25 | 26 | class CJNIPowerManager : public CJNIBase 27 | { 28 | public: 29 | CJNIPowerManager(const jni::jhobject &object) : CJNIBase(object) {}; 30 | ~CJNIPowerManager() {}; 31 | 32 | CJNIWakeLock newWakeLock(int levelAndFlags, const std::string &name); 33 | void reboot(const std::string &reason); 34 | void goToSleep(int64_t timestamp); 35 | 36 | static void PopulateStaticFields(); 37 | 38 | // Deprecated in API level 17 39 | static int FULL_WAKE_LOCK; 40 | // Deprecated in API level 15 41 | static int SCREEN_BRIGHT_WAKE_LOCK; 42 | static int ON_AFTER_RELEASE; 43 | 44 | private: 45 | CJNIPowerManager(); 46 | }; 47 | -------------------------------------------------------------------------------- /src/RecognizerIntent.cpp: -------------------------------------------------------------------------------- 1 | #include "RecognizerIntent.h" 2 | #include "Activity.h" 3 | #include "ClassLoader.h" 4 | 5 | #include "jutils-details.hpp" 6 | 7 | #include 8 | 9 | 10 | using namespace jni; 11 | 12 | std::string CJNIRecognizerIntent::ACTION_RECOGNIZE_SPEECH; 13 | std::string CJNIRecognizerIntent::EXTRA_RESULTS; 14 | std::string CJNIRecognizerIntent::EXTRA_LANGUAGE_MODEL; 15 | std::string CJNIRecognizerIntent::LANGUAGE_MODEL_FREE_FORM; 16 | 17 | const char *CJNIRecognizerIntent::m_classname = "android/speech/RecognizerIntent"; 18 | 19 | void CJNIRecognizerIntent::PopulateStaticFields() 20 | { 21 | jhclass clazz = find_class(m_classname); 22 | ACTION_RECOGNIZE_SPEECH = jcast(get_static_field(clazz, "ACTION_RECOGNIZE_SPEECH")); 23 | EXTRA_RESULTS = jcast(get_static_field(clazz, "EXTRA_RESULTS")); 24 | EXTRA_LANGUAGE_MODEL = jcast(get_static_field(clazz, "EXTRA_LANGUAGE_MODEL")); 25 | LANGUAGE_MODEL_FREE_FORM = jcast(get_static_field(clazz, "LANGUAGE_MODEL_FREE_FORM")); 26 | } 27 | 28 | CJNIRecognizerIntent::CJNIRecognizerIntent() 29 | : CJNIBase(CJNIRecognizerIntent::m_classname) 30 | { 31 | m_object = new_object(CJNIContext::getClassLoader().loadClass(GetDotClassName(m_classname))); 32 | m_object.setGlobal(); 33 | } 34 | -------------------------------------------------------------------------------- /src/RecognizerIntent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2016 Christian Browet 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | class CJNIRecognizerIntent : public CJNIBase 25 | { 26 | public: 27 | CJNIRecognizerIntent(const jni::jhobject &object) : CJNIBase(object) {} 28 | CJNIRecognizerIntent(); 29 | 30 | static void PopulateStaticFields(); 31 | 32 | static std::string ACTION_RECOGNIZE_SPEECH; 33 | static std::string EXTRA_RESULTS; 34 | static std::string EXTRA_LANGUAGE_MODEL; 35 | static std::string LANGUAGE_MODEL_FREE_FORM; 36 | 37 | static const char *m_classname; 38 | }; 39 | 40 | -------------------------------------------------------------------------------- /src/Rect.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2016 Christian Browet 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | class CJNIRect: public CJNIBase 25 | { 26 | public: 27 | CJNIRect(const jni::jhobject &object) : CJNIBase(object){} 28 | ~CJNIRect(){} 29 | 30 | CJNIRect(); 31 | CJNIRect(int l, int t, int r, int b); 32 | 33 | // Fields 34 | int getLeft(); 35 | int getTop(); 36 | int getRight(); 37 | int getBottom(); 38 | 39 | int width(); 40 | int height(); 41 | 42 | bool equals(const CJNIRect &other); 43 | std::string toString() const; 44 | int describeContents() const; 45 | 46 | }; 47 | -------------------------------------------------------------------------------- /src/Resources.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Team XBMC 3 | * http://xbmc.org 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with XBMC; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | #include "Resources.h" 22 | #include "Drawable.h" 23 | #include "jutils-details.hpp" 24 | 25 | using namespace jni; 26 | 27 | CJNIDrawable CJNIResources::getDrawableForDensity(int id, int density) 28 | { 29 | return call_method(m_object, 30 | "getDrawableForDensity", "(II)Landroid/graphics/drawable/Drawable;", 31 | id, density); 32 | } 33 | 34 | CJNIDrawable CJNIResources::getDrawableForDensity(int id, int density, const CJNIResourcesTheme& theme) 35 | { 36 | return call_method(m_object, 37 | "getDrawableForDensity", 38 | "(IILandroid/content/res/Resources$Theme;)Landroid/graphics/drawable/Drawable;", 39 | id, density, theme.get_raw()); 40 | } 41 | 42 | int CJNIResources::getIdentifier(const std::string &name, 43 | const std::string &type, 44 | const std::string &package) 45 | { 46 | return call_method(m_object, 47 | "getIdentifier", 48 | "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I", 49 | jcast(name), jcast(type), jcast(package)); 50 | } 51 | -------------------------------------------------------------------------------- /src/Resources.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2013 Team XBMC 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | class CJNIDrawable; 25 | class CJNIResourcesTheme; 26 | 27 | class CJNIResources : public CJNIBase 28 | { 29 | public: 30 | CJNIResources(const jni::jhobject &object) : CJNIBase(object) {}; 31 | ~CJNIResources() {}; 32 | 33 | // Deprecated in API level 22 34 | CJNIDrawable getDrawableForDensity(int id, int density); 35 | CJNIDrawable getDrawableForDensity(int id, int density, const CJNIResourcesTheme& theme); 36 | 37 | int getIdentifier(const std::string &name, const std::string &type, const std::string &package); 38 | 39 | private: 40 | CJNIResources(); 41 | }; 42 | 43 | class CJNIResourcesTheme : public CJNIBase 44 | { 45 | public: 46 | CJNIResourcesTheme(const jni::jhobject& object) : CJNIBase(object) {}; 47 | ~CJNIResourcesTheme() {}; 48 | }; 49 | -------------------------------------------------------------------------------- /src/RouteInfo.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Christian Browet 3 | * http://xbmc.org 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with XBMC; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | #include "RouteInfo.h" 22 | #include "InetAddress.h" 23 | 24 | #include "jutils-details.hpp" 25 | 26 | using namespace jni; 27 | 28 | std::string CJNIRouteInfo::getInterface() 29 | { 30 | return jcast(call_method(m_object, 31 | "getInterface", "()Ljava/lang/String;")); 32 | } 33 | 34 | CJNIInetAddress CJNIRouteInfo::getGateway() 35 | { 36 | return call_method(m_object, 37 | "getGateway", "()Ljava/net/InetAddress;"); 38 | } 39 | 40 | bool CJNIRouteInfo::isDefaultRoute() 41 | { 42 | return call_method(m_object, 43 | "isDefaultRoute", "()Z"); 44 | } 45 | 46 | bool CJNIRouteInfo::equals(const CJNIRouteInfo& other) 47 | { 48 | return call_method(m_object, 49 | "equals", "(Ljava/lang/Object;)Z", other.get_raw()); 50 | } 51 | 52 | std::string CJNIRouteInfo::toString() const 53 | { 54 | return jcast(call_method(m_object, 55 | "toString", "()Ljava/lang/String;")); 56 | } 57 | 58 | int CJNIRouteInfo::describeContents() const 59 | { 60 | return call_method(m_object, 61 | "describeContents", "()I"); 62 | } 63 | 64 | -------------------------------------------------------------------------------- /src/RouteInfo.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2016 Christian Browet 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | class CJNIInetAddress; 25 | 26 | class CJNIRouteInfo : public CJNIBase 27 | { 28 | public: 29 | CJNIRouteInfo(const jni::jhobject &object) : CJNIBase(object){} 30 | ~CJNIRouteInfo(){} 31 | 32 | std::string getInterface(); 33 | CJNIInetAddress getGateway(); 34 | bool isDefaultRoute(); 35 | 36 | bool equals(const CJNIRouteInfo &other); 37 | std::string toString() const; 38 | int describeContents() const; 39 | 40 | protected: 41 | CJNIRouteInfo(); 42 | }; 43 | -------------------------------------------------------------------------------- /src/ScanResult.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Team XBMC 3 | * http://xbmc.org 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with XBMC; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | #include "ScanResult.h" 22 | #include "jutils-details.hpp" 23 | 24 | using namespace jni; 25 | 26 | CJNIScanResult::CJNIScanResult(const jhobject &object) : CJNIBase(object) 27 | ,SSID( jcast(get_field(m_object, "SSID"))) 28 | ,BSSID( jcast(get_field(m_object, "BSSID"))) 29 | ,capabilities(jcast(get_field(m_object, "capabilities"))) 30 | ,level( get_field(m_object, "level")) 31 | ,frequency( get_field(m_object, "frequency")) 32 | { 33 | } 34 | 35 | std::string CJNIScanResult::toString() 36 | { 37 | return jcast(call_method(m_object, 38 | "toString", "()Ljava/lang/String;")); 39 | } 40 | 41 | int CJNIScanResult::describeContents() 42 | { 43 | return call_method(m_object, 44 | "describeContents", "()I"); 45 | } 46 | -------------------------------------------------------------------------------- /src/ScanResult.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2013 Team XBMC 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include 23 | #include 24 | 25 | #include "JNIBase.h" 26 | 27 | class CJNIScanResult : public CJNIBase 28 | { 29 | public: 30 | CJNIScanResult(const jni::jhobject &object); 31 | ~CJNIScanResult(){}; 32 | 33 | // Deprecated in API level 33 34 | std::string SSID; 35 | std::string BSSID; 36 | std::string capabilities; 37 | int level; 38 | int frequency; 39 | std::string toString(); 40 | int describeContents(); 41 | 42 | private: 43 | CJNIScanResult(); 44 | }; 45 | 46 | typedef std::vector CJNIScanResults; 47 | -------------------------------------------------------------------------------- /src/ServiceManager.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Christian Browet 3 | * http://xbmc.org 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with XBMC; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | #include "ServiceManager.h" 22 | #include "jutils-details.hpp" 23 | 24 | #include "IBinder.h" 25 | 26 | using namespace jni; 27 | 28 | 29 | CJNIIBinder CJNIServiceManager::getService(std::string name) 30 | { 31 | return call_static_method("android/os/ServiceManager", 32 | "getService", "(Ljava/lang/String;)Landroid/os/IBinder;", 33 | jcast(name)); 34 | } 35 | -------------------------------------------------------------------------------- /src/ServiceManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2016 Christian Browet 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | namespace jni 25 | { 26 | 27 | class CJNIIBinder; 28 | 29 | class CJNIServiceManager : public CJNIBase 30 | { 31 | public: 32 | 33 | static CJNIIBinder getService(std::string name); 34 | 35 | protected: 36 | CJNIServiceManager(); 37 | virtual ~CJNIServiceManager(); 38 | }; 39 | 40 | } 41 | 42 | -------------------------------------------------------------------------------- /src/Set.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Christian Browet 3 | * http://xbmc.org 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with XBMC; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | #include "Set.h" 22 | #include "jutils-details.hpp" 23 | 24 | using namespace jni; 25 | 26 | 27 | template 28 | CJNIIterator CJNISet::iterator() 29 | { 30 | return call_method(m_object, 31 | "iterator", "()Ljava/util/Iterator;"); 32 | } 33 | 34 | namespace jni 35 | { 36 | template class CJNISet; 37 | } 38 | -------------------------------------------------------------------------------- /src/Set.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2016 Christian Browet 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | #include "Iterator.h" 25 | 26 | namespace jni 27 | { 28 | 29 | template 30 | class CJNISet : public CJNIBase 31 | { 32 | public: 33 | CJNISet(const jni::jhobject &object) : CJNIBase(object) {} 34 | virtual ~CJNISet() {} 35 | 36 | CJNIIterator iterator(); 37 | }; 38 | 39 | } 40 | 41 | -------------------------------------------------------------------------------- /src/SpeechRecognizer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2022 Team Kodi 4 | * This file is part of Kodi - https://kodi.tv 5 | * 6 | * SPDX-License-Identifier: GPL-2.0-or-later 7 | * See LICENSES/README.md for more information. 8 | */ 9 | 10 | #include "JNIBase.h" 11 | #include "Bundle.h" 12 | #include "Context.h" 13 | #include "Intent.h" 14 | 15 | class CJNISpeechRecognitionListener : virtual public CJNIBase 16 | { 17 | public: 18 | virtual void onReadyForSpeech(CJNIBundle bundle) = 0; 19 | virtual void onError(int i) = 0; 20 | virtual void onResults(CJNIBundle bundle) = 0; 21 | }; 22 | 23 | class CJNISpeechRecognizer : public CJNIBase 24 | { 25 | public: 26 | CJNISpeechRecognizer(const jni::jhobject &object) : CJNIBase(object) {}; 27 | ~CJNISpeechRecognizer() {}; 28 | 29 | static void PopulateStaticFields(); 30 | 31 | static int ERROR_AUDIO; 32 | static int ERROR_CLIENT; 33 | static int ERROR_INSUFFICIENT_PERMISSIONS; 34 | static int ERROR_NETWORK; 35 | static int ERROR_NETWORK_TIMEOUT; 36 | static int ERROR_NO_MATCH; 37 | static int ERROR_RECOGNIZER_BUSY; 38 | static int ERROR_SERVER; 39 | static int ERROR_SPEECH_TIMEOUT; 40 | static std::string RESULTS_RECOGNITION; 41 | 42 | static bool isRecognitionAvailable (const CJNIContext& context); 43 | static CJNISpeechRecognizer createSpeechRecognizer(const CJNIContext& context); 44 | void setRecognitionListener(const CJNISpeechRecognitionListener& listener); 45 | void startListening(const CJNIIntent& intent); 46 | }; 47 | -------------------------------------------------------------------------------- /src/StatFs.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Team XBMC 3 | * http://xbmc.org 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with XBMC; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | #include "StatFs.h" 22 | #include "jutils-details.hpp" 23 | 24 | using namespace jni; 25 | 26 | CJNIStatFs::CJNIStatFs(const std::string &path) : CJNIBase("android/os/StatFs") 27 | { 28 | m_object = new_object(GetClassName(), "", 29 | "(Ljava/lang/String;)V", 30 | jcast(path)); 31 | m_object.setGlobal(); 32 | } 33 | 34 | void CJNIStatFs::restat(const std::string &path) 35 | { 36 | call_method(m_object, 37 | "restat", "(Ljava/lang/String;)V", 38 | jcast(path)); 39 | } 40 | 41 | int CJNIStatFs::getBlockSize() 42 | { 43 | return call_method(m_object, 44 | "getBlockSize", "()I"); 45 | } 46 | 47 | int CJNIStatFs::getBlockCount() 48 | { 49 | return call_method(m_object, 50 | "getBlockCount", "()I"); 51 | } 52 | 53 | int CJNIStatFs::getFreeBlocks() 54 | { 55 | return call_method(m_object, 56 | "getFreeBlocks", "()I"); 57 | } 58 | 59 | int CJNIStatFs::getAvailableBlocks() 60 | { 61 | return call_method(m_object, 62 | "getAvailableBlocks", "()I"); 63 | } 64 | -------------------------------------------------------------------------------- /src/StatFs.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2013 Team XBMC 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | class CJNIStatFs : public CJNIBase 25 | { 26 | public: 27 | CJNIStatFs(const std::string &path); 28 | CJNIStatFs(const jni::jhobject &object) : CJNIBase(object) {}; 29 | ~CJNIStatFs() {}; 30 | 31 | void restat(const std::string &path); 32 | // Deprecated in API level 18 33 | int getBlockSize(); 34 | // Deprecated in API level 18 35 | int getBlockCount(); 36 | // Deprecated in API level 18 37 | int getFreeBlocks(); 38 | int getAvailableBlocks(); 39 | }; 40 | -------------------------------------------------------------------------------- /src/StorageManager.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 Team Kodi 3 | * http://xbmc.org 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with XBMC; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | #include "StorageManager.h" 22 | 23 | #include "jutils-details.hpp" 24 | 25 | using namespace jni; 26 | 27 | CJNIStorageVolume CJNIStorageManager::getPrimaryStorageVolume() 28 | { 29 | return call_method(m_object, "getPrimaryStorageVolume", 30 | "()Landroid/os/storage/StorageVolume;"); 31 | } 32 | 33 | CJNIList CJNIStorageManager::getStorageVolumes() 34 | { 35 | if (GetSDKVersion() >= 24) 36 | return call_method(m_object, "getStorageVolumes", "()Ljava/util/List;"); 37 | 38 | return CJNIList(jhobject()); 39 | } 40 | -------------------------------------------------------------------------------- /src/StorageManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2015 Team Kodi 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | #include "List.h" 25 | #include "StorageVolume.h" 26 | 27 | class CJNIStorageManager : public CJNIBase 28 | { 29 | public: 30 | CJNIStorageManager(const jni::jhobject &object) : CJNIBase(object) {}; 31 | ~CJNIStorageManager() {}; 32 | 33 | CJNIStorageVolume getPrimaryStorageVolume(); 34 | CJNIList getStorageVolumes(); 35 | 36 | private: 37 | CJNIStorageManager(); 38 | }; 39 | -------------------------------------------------------------------------------- /src/StorageVolume.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2015 Team Kodi 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | #include "Context.h" 25 | #include "File.h" 26 | #include "List.h" 27 | 28 | class CJNIStorageVolume : public CJNIBase 29 | { 30 | public: 31 | CJNIStorageVolume(const jni::jhobject &object) : CJNIBase(object) {}; 32 | ~CJNIStorageVolume() {}; 33 | 34 | std::string getPath(); 35 | std::string getDescription(const CJNIContext& context); 36 | int getDescriptionId(); 37 | CJNIFile getDirectory(); 38 | 39 | bool isPrimary(); 40 | bool isRemovable(); 41 | bool isEmulated(); 42 | 43 | int64_t getMaxFileSize(); 44 | std::string getUuid(); 45 | int getFatVolumeId(); 46 | 47 | std::string getUserLabel(); 48 | std::string getState(); 49 | 50 | private: 51 | CJNIStorageVolume(); 52 | }; 53 | 54 | typedef CJNIList CJNIStorageVolumes; 55 | -------------------------------------------------------------------------------- /src/Surface.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2013 Team XBMC 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | class CJNISurfaceTexture; 25 | class CJNISurface : public CJNIBase 26 | { 27 | public: 28 | CJNISurface(); 29 | CJNISurface(const CJNISurfaceTexture &surfaceTexture); 30 | CJNISurface(const jni::jhobject &object) : CJNIBase(object) {}; 31 | ~CJNISurface() {}; 32 | 33 | bool isValid(); 34 | void release(); 35 | //CJNICanvas lockCanvas(CJNIRect); 36 | //void unlockCanvasAndPost(const CJNICanvas &canvas); 37 | //void unlockCanvas(const CJNICanvas &canvas); 38 | std::string toString(); 39 | 40 | int describeContents(); 41 | static void PopulateStaticFields(); 42 | void setFrameRate (float frameRate, int compatibility, int changeFrameRateStrategy); 43 | static int ROTATION_0; 44 | static int ROTATION_90; 45 | static int ROTATION_180; 46 | static int ROTATION_270; 47 | static int FRAME_RATE_COMPATIBILITY_FIXED_SOURCE; 48 | static int FRAME_RATE_COMPATIBILITY_DEFAULT; 49 | static int CHANGE_FRAME_RATE_ONLY_IF_SEAMLESS; 50 | static int CHANGE_FRAME_RATE_ALWAYS; 51 | 52 | private: 53 | static const char *m_classname; 54 | }; 55 | -------------------------------------------------------------------------------- /src/SurfaceHolder.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Christian Browet 3 | * http://xbmc.org 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with XBMC; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | #include "Surface.h" 22 | #include "SurfaceHolder.h" 23 | #include "jutils-details.hpp" 24 | 25 | using namespace jni; 26 | 27 | 28 | CJNISurface CJNISurfaceHolder::getSurface() 29 | { 30 | return call_method(m_object, 31 | "getSurface", "()Landroid/view/Surface;"); 32 | } 33 | 34 | void CJNISurfaceHolder::setFixedSize(int width, int height) 35 | { 36 | call_method(m_object, 37 | "setFixedSize", "(II)V"); 38 | } 39 | 40 | void CJNISurfaceHolder::setSizeFromLayout() 41 | { 42 | call_method(m_object, 43 | "setSizeFromLayout", "()V"); 44 | } 45 | -------------------------------------------------------------------------------- /src/SurfaceHolder.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2016 Christian Browet 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | class CJNISurface; 25 | class CJNISurfaceHolder; 26 | 27 | class CJNISurfaceHolderCallback : virtual public CJNIBase 28 | { 29 | public: 30 | virtual void surfaceChanged(CJNISurfaceHolder holder, int format, int width, int height) = 0; 31 | virtual void surfaceCreated(CJNISurfaceHolder holder) = 0; 32 | virtual void surfaceDestroyed(CJNISurfaceHolder holder) = 0; 33 | }; 34 | 35 | class CJNISurfaceHolder : public CJNIBase 36 | { 37 | public: 38 | CJNISurfaceHolder() : CJNIBase() {} 39 | CJNISurfaceHolder(const jni::jhobject &object) : CJNIBase(object) {} 40 | ~CJNISurfaceHolder() {} 41 | 42 | CJNISurface getSurface(); 43 | void setFixedSize(int width, int height); 44 | void setSizeFromLayout(); 45 | }; 46 | -------------------------------------------------------------------------------- /src/SurfaceTexture.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2013 Team XBMC 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | class CJNISurfaceTexture; 25 | 26 | class CJNISurfaceTextureOnFrameAvailableListener : virtual public CJNIBase 27 | { 28 | public: 29 | virtual void onFrameAvailable(CJNISurfaceTexture surfaceTexture) = 0; 30 | }; 31 | 32 | class CJNISurfaceTexture : public CJNIBase 33 | { 34 | public: 35 | CJNISurfaceTexture(const jni::jhobject &object) : CJNIBase(object) {}; 36 | CJNISurfaceTexture(int texName); 37 | ~CJNISurfaceTexture() {}; 38 | 39 | void setOnFrameAvailableListener(const CJNISurfaceTextureOnFrameAvailableListener& listener); 40 | void setDefaultBufferSize(int width, int height); 41 | void updateTexImage(); 42 | void detachFromGLContext(); 43 | void attachToGLContext(int texName); 44 | void getTransformMatrix(float* mtx); // mtx MUST BE a preallocated 4x4 float array 45 | int64_t getTimestamp(); 46 | void release(); 47 | }; 48 | -------------------------------------------------------------------------------- /src/SurfaceView.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Team Kodi 3 | * http://kodi.tv 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with Kodi; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | #include "JNIBase.h" 22 | #include "SurfaceView.h" 23 | #include "Context.h" 24 | #include "SurfaceHolder.h" 25 | 26 | #include "jutils-details.hpp" 27 | 28 | using namespace jni; 29 | 30 | const char* CJNISurfaceView::m_classname = "android/view/SurfaceView"; 31 | 32 | CJNISurfaceView::CJNISurfaceView(const CJNIContext &context) : CJNIView(m_classname) 33 | { 34 | m_object = new_object(m_classname, "", "(Landroid/content/Context;)V", context.get_raw()); 35 | m_object.setGlobal(); 36 | } 37 | -------------------------------------------------------------------------------- /src/SurfaceView.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2018 Team Kodi 4 | * http://kodi.tv 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Kodi; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | #include "View.h" 24 | 25 | class CJNISurfaceHolder; 26 | class CJNIContext; 27 | 28 | class CJNISurfaceView : public CJNIView 29 | { 30 | public: 31 | CJNISurfaceView(const CJNIContext &context); 32 | CJNISurfaceView(const jni::jhobject &object) : CJNIView(object) {}; 33 | ~CJNISurfaceView() {}; 34 | 35 | private: 36 | static const char *m_classname; 37 | }; 38 | -------------------------------------------------------------------------------- /src/System.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2013 Team XBMC 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | class CJNISystem 25 | { 26 | public: 27 | static std::string getProperty( const std::string &property); 28 | static std::string getProperty( const std::string &property, const std::string &defaultValue); 29 | static std::string setProperty( const std::string &property, const std::string &defaultValue); 30 | static std::string clearProperty(const std::string &property); 31 | static int64_t nanoTime(); 32 | 33 | private: 34 | CJNISystem(); 35 | ~CJNISystem() {}; 36 | }; 37 | -------------------------------------------------------------------------------- /src/SystemClock.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Team XBMC 3 | * http://xbmc.org 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with XBMC; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | #include "SystemClock.h" 22 | #include "jutils-details.hpp" 23 | 24 | using namespace jni; 25 | 26 | int64_t CJNISystemClock::uptimeMillis() 27 | { 28 | return call_static_method("android/os/SystemClock", 29 | "uptimeMillis", "()J"); 30 | } 31 | 32 | 33 | int64_t CJNISystemClock::elapsedRealtime() 34 | { 35 | return call_static_method("android/os/SystemClock", 36 | "elapsedRealtime", "()J"); 37 | } 38 | -------------------------------------------------------------------------------- /src/SystemClock.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2013 Team XBMC 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include 23 | 24 | // This class contains only static methods, so no need to inherit from JNIBase. 25 | class CJNISystemClock 26 | { 27 | public: 28 | static int64_t uptimeMillis(); 29 | static int64_t elapsedRealtime(); 30 | 31 | private: 32 | CJNISystemClock() {}; 33 | ~CJNISystemClock() {}; 34 | }; 35 | -------------------------------------------------------------------------------- /src/SystemProperties.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Team XBMC 3 | * http://xbmc.org 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with XBMC; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | #include "SystemProperties.h" 22 | #include "jutils-details.hpp" 23 | 24 | using namespace jni; 25 | const char *CJNISystemProperties::m_classname = "android/os/SystemProperties"; 26 | 27 | std::string CJNISystemProperties::get(const std::string& property, const std::string& defaultValue) 28 | { 29 | return jcast(call_static_method(m_classname, 30 | "get", "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;", 31 | jcast(property), jcast(defaultValue))); 32 | } 33 | -------------------------------------------------------------------------------- /src/SystemProperties.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2013 Team XBMC 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | class CJNISystemProperties 25 | { 26 | public: 27 | static std::string get(const std::string& property, const std::string& defaultValue); 28 | 29 | private: 30 | CJNISystemProperties(); 31 | ~CJNISystemProperties() {}; 32 | static const char *m_classname; 33 | }; 34 | -------------------------------------------------------------------------------- /src/URI.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2013 Team XBMC 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | class CJNIURI : public CJNIBase 25 | { 26 | public: 27 | CJNIURI(const jni::jhobject &uri) : CJNIBase(uri) {} 28 | ~CJNIURI() {} 29 | 30 | static CJNIURI EMPTY; 31 | static void PopulateStaticFields(); 32 | 33 | std::string getScheme() const; 34 | std::string toString() const; 35 | std::string getLastPathSegment() const; 36 | std::string getPath() const; 37 | static CJNIURI parse(const std::string &uriString); 38 | 39 | private: 40 | CJNIURI() : CJNIBase() {} 41 | }; 42 | -------------------------------------------------------------------------------- /src/URIPermission.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Team XBMC 3 | * http://xbmc.org 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with XBMC; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | #include "URIPermission.h" 22 | #include "jutils-details.hpp" 23 | 24 | using namespace jni; 25 | 26 | std::string CJNIURIPermission::toString() const 27 | { 28 | return jcast(call_method(m_object, 29 | "toString", "()Ljava/lang/String;")); 30 | } 31 | 32 | CJNIURI CJNIURIPermission::getUri() const 33 | { 34 | return (CJNIURI)call_method(m_object, 35 | "getUri", "()Landroid/net/Uri;"); 36 | } 37 | -------------------------------------------------------------------------------- /src/URIPermission.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2013 Team XBMC 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | #include "URI.h" 25 | 26 | class CJNIURIPermission : public CJNIBase 27 | { 28 | public: 29 | CJNIURIPermission(const jni::jhobject &uri) : CJNIBase(uri) {}; 30 | ~CJNIURIPermission() {}; 31 | 32 | std::string toString() const; 33 | CJNIURI getUri() const; 34 | 35 | private: 36 | CJNIURIPermission(); 37 | }; 38 | -------------------------------------------------------------------------------- /src/UUID.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Team Kodi 3 | * http://xbmc.org 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with XBMC; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | 22 | #include "UUID.h" 23 | 24 | #include "jutils-details.hpp" 25 | 26 | using namespace jni; 27 | 28 | CJNIUUID::CJNIUUID(int64_t mostSigBits, int64_t leastSigBits) 29 | : CJNIBase("java/util/UUID") 30 | { 31 | m_object = new_object(GetClassName(), "", "(JJ)V", mostSigBits, leastSigBits); 32 | m_object.setGlobal(); 33 | } 34 | -------------------------------------------------------------------------------- /src/UUID.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2016 Team Kodi 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | class CJNIUUID : public CJNIBase 25 | { 26 | public: 27 | CJNIUUID(int64_t mostSigBits, int64_t leastSigBits); 28 | CJNIUUID(const jni::jhobject &object) : CJNIBase(object) {} 29 | ~CJNIUUID() {} 30 | }; 31 | -------------------------------------------------------------------------------- /src/WakeLock.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Team XBMC 3 | * http://xbmc.org 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with XBMC; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | 21 | #include "WakeLock.h" 22 | #include "jutils-details.hpp" 23 | 24 | using namespace jni; 25 | 26 | void CJNIWakeLock::acquire() 27 | { 28 | call_method(m_object, 29 | "acquire", "()V"); 30 | } 31 | 32 | void CJNIWakeLock::release() 33 | { 34 | call_method(m_object, 35 | "release", "()V"); 36 | } 37 | 38 | bool CJNIWakeLock::isHeld() 39 | { 40 | return call_method(m_object, 41 | "isHeld", "()Z"); 42 | } 43 | 44 | void CJNIWakeLock::setReferenceCounted(bool val) 45 | { 46 | call_method(m_object, 47 | "setReferenceCounted", "(Z)V", val); 48 | } 49 | 50 | -------------------------------------------------------------------------------- /src/WakeLock.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2013 Team XBMC 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | class CJNIWakeLock : public CJNIBase 25 | { 26 | public: 27 | CJNIWakeLock(const jni::jhobject &wakelock) : CJNIBase(wakelock) {}; 28 | ~CJNIWakeLock() {}; 29 | 30 | void acquire(); 31 | void release(); 32 | bool isHeld(); 33 | void setReferenceCounted(bool val); 34 | 35 | protected: 36 | CJNIWakeLock(); 37 | }; 38 | -------------------------------------------------------------------------------- /src/WifiInfo.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2013 Team XBMC 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | #include "Enum.h" 24 | #include "NetworkInfo.h" 25 | 26 | class CJNISupplicantState : public CJNIEnum 27 | { 28 | public: 29 | CJNISupplicantState(const jni::jhobject &object) : CJNIEnum(object){}; 30 | ~CJNISupplicantState(){}; 31 | 32 | private: 33 | CJNISupplicantState(); 34 | }; 35 | 36 | class CJNIWifiInfo : public CJNIBase 37 | { 38 | public: 39 | CJNIWifiInfo(const jni::jhobject &object) : CJNIBase(object){}; 40 | ~CJNIWifiInfo(){}; 41 | 42 | std::string getSSID() const; 43 | std::string getBSSID() const; 44 | int getRssi() const; 45 | int getLinkSpeed() const; 46 | std::string getMacAddress() const; 47 | int getNetworkId() const; 48 | // Deprecated in API level 31 49 | int getIpAddress() const; 50 | bool getHiddenSSID() const; 51 | std::string toString() const; 52 | int describeContents() const; 53 | CJNISupplicantState getSupplicantState() const; 54 | static CJNINetworkInfoDetailedState getDetailedStateOf(const CJNISupplicantState &suppState); 55 | 56 | private: 57 | CJNIWifiInfo(); 58 | }; 59 | -------------------------------------------------------------------------------- /src/WifiManagerMulticastLock.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 Team XBMC 3 | * http://xbmc.org 4 | * 5 | * This Program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2, or (at your option) 8 | * any later version. 9 | * 10 | * This Program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with XBMC; see the file COPYING. If not, see 17 | * . 18 | * 19 | */ 20 | #include "WifiManagerMulticastLock.h" 21 | #include "jutils-details.hpp" 22 | 23 | using namespace jni; 24 | 25 | void CJNIWifiManagerMulticastLock::acquire() 26 | { 27 | call_method(m_object, "acquire", "()V"); 28 | } 29 | 30 | void CJNIWifiManagerMulticastLock::release() 31 | { 32 | call_method(m_object, "release", "()V"); 33 | } 34 | 35 | void CJNIWifiManagerMulticastLock::setReferenceCounted(bool refCounted) 36 | { 37 | call_method(m_object, "setReferenceCounted", "(Z)V", refCounted); 38 | } 39 | 40 | bool CJNIWifiManagerMulticastLock::isHeld() 41 | { 42 | return call_method(m_object, "isHeld", "()Z"); 43 | } 44 | 45 | std::string CJNIWifiManagerMulticastLock::toString() 46 | { 47 | return jcast(call_method(m_object, "toString", "()Ljava/lang/String;")); 48 | } 49 | -------------------------------------------------------------------------------- /src/WifiManagerMulticastLock.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2013 Team XBMC 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | #include "JNIBase.h" 22 | 23 | class CJNIWifiManagerMulticastLock : public CJNIBase 24 | { 25 | public: 26 | CJNIWifiManagerMulticastLock(const jni::jhobject &wakelock) : CJNIBase(wakelock){}; 27 | ~CJNIWifiManagerMulticastLock(){}; 28 | void acquire(); 29 | void release(); 30 | void setReferenceCounted(bool refCounted); 31 | bool isHeld(); 32 | std::string toString(); 33 | private: 34 | CJNIWifiManagerMulticastLock(); 35 | }; 36 | -------------------------------------------------------------------------------- /src/Window.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2013 Team XBMC 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with XBMC; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | class CJNIView; 25 | class CJNIWindowManagerLayoutParams; 26 | 27 | class CJNIWindow : public CJNIBase 28 | { 29 | public: 30 | CJNIWindow(const jni::jhobject &object) : CJNIBase(object) {}; 31 | ~CJNIWindow() {}; 32 | 33 | CJNIWindowManagerLayoutParams getAttributes(); 34 | void setAttributes(const CJNIWindowManagerLayoutParams& attributes); 35 | const jni::jhobject getCallback(); 36 | void setCallback(const jni::jhobject &object); 37 | 38 | CJNIView getDecorView(); 39 | 40 | void addFlags (int flags); 41 | void clearFlags (int flags); 42 | }; 43 | -------------------------------------------------------------------------------- /src/WindowManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (C) 2014 Team Kodi 4 | * http://xbmc.org 5 | * 6 | * This Program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This Program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Kodi; see the file COPYING. If not, see 18 | * . 19 | * 20 | */ 21 | 22 | #include "JNIBase.h" 23 | 24 | class CJNIDisplay; 25 | 26 | class CJNIWindowManager : public CJNIBase 27 | { 28 | public: 29 | CJNIWindowManager(const jni::jhobject &object) : CJNIBase(object) {} 30 | ~CJNIWindowManager() {} 31 | 32 | CJNIDisplay getDefaultDisplay(); 33 | }; 34 | 35 | class CJNIWindowManagerLayoutParams : public CJNIBase 36 | { 37 | public: 38 | CJNIWindowManagerLayoutParams(const jni::jhobject &object) : CJNIBase(object) {}; 39 | ~CJNIWindowManagerLayoutParams() {}; 40 | 41 | float getpreferredRefreshRate() const; 42 | void setpreferredRefreshRate(float rate); 43 | int getpreferredDisplayModeId() const; 44 | void setpreferredDisplayModeId(int modeid); 45 | 46 | static void PopulateStaticFields(); 47 | static int FLAG_KEEP_SCREEN_ON; 48 | }; 49 | --------------------------------------------------------------------------------