2 * Copyright (C) 2012-2013 Team XBMC
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)
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.
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 * <http://www.gnu.org/licenses/>.
23 #if defined(TARGET_ANDROID)
25 #include "AndroidAppFile.h"
29 #include "utils/log.h"
30 #include "utils/URIUtils.h"
32 #include "android/activity/XBMCApp.h"
33 using namespace XFILE;
35 CFileAndroidApp::CFileAndroidApp(void)
41 CFileAndroidApp::~CFileAndroidApp(void)
46 bool CFileAndroidApp::Open(const CURL& url)
49 m_appname = URIUtils::GetFileName(url.Get());
50 m_appname = m_appname.substr(0, m_appname.size() - 4);
52 std::vector<androidPackage> applications = CXBMCApp::GetApplications();
53 for(std::vector<androidPackage>::iterator i = applications.begin(); i != applications.end(); ++i)
55 if ((*i).packageName == m_appname)
62 bool CFileAndroidApp::Exists(const CURL& url)
64 std::string appname = URIUtils::GetFileName(url.Get());
65 appname = appname.substr(0, appname.size() - 4);
67 std::vector<androidPackage> applications = CXBMCApp::GetApplications();
68 for(std::vector<androidPackage>::iterator i = applications.begin(); i != applications.end(); ++i)
70 if ((*i).packageName == appname)
77 unsigned int CFileAndroidApp::Read(void* lpBuf, int64_t uiBufSize)
79 CXBMCApp::GetIcon(m_appname, lpBuf, uiBufSize);
83 void CFileAndroidApp::Close()
87 int64_t CFileAndroidApp::GetLength()
89 CXBMCApp::GetIconSize(m_appname, &m_iconWidth, &m_iconHeight);
90 return m_iconWidth * m_iconHeight * 4;
93 unsigned int CFileAndroidApp::GetIconWidth()
98 unsigned int CFileAndroidApp::GetIconHeight()
103 int CFileAndroidApp::GetChunkSize()
107 int CFileAndroidApp::Stat(const CURL& url, struct __stat64* buffer)
111 int CFileAndroidApp::IoControl(EIoControl request, void* param)
113 if(request == IOCTRL_SEEK_POSSIBLE)