├── .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