blob: e9900249b289d3a0962febf25f440eab4786a482 [file] [log] [blame]
Kenny Root05105f72010-09-22 17:29:43 -07001/*
2 * Copyright (C) 2010 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#define LOG_TAG "NObb"
18
19#include <android/obb.h>
20
Mathias Agopianb13b9bd2012-02-17 18:27:36 -080021#include <androidfw/ObbFile.h>
Kenny Root05105f72010-09-22 17:29:43 -070022#include <utils/Log.h>
Kenny Root05105f72010-09-22 17:29:43 -070023
24using namespace android;
25
26struct AObbInfo : public ObbFile {};
27
28AObbInfo* AObbScanner_getObbInfo(const char* filename) {
29 AObbInfo* obbFile = new AObbInfo();
30 if (obbFile == NULL || !obbFile->readFrom(filename)) {
31 delete obbFile;
32 return NULL;
33 }
34 obbFile->incStrong((void*)AObbScanner_getObbInfo);
35 return static_cast<AObbInfo*>(obbFile);
36}
37
38void AObbInfo_delete(AObbInfo* obbInfo) {
39 if (obbInfo != NULL) {
40 obbInfo->decStrong((void*)AObbScanner_getObbInfo);
41 }
42}
43
44const char* AObbInfo_getPackageName(AObbInfo* obbInfo) {
45 return obbInfo->getPackageName();
46}
47
48int32_t AObbInfo_getVersion(AObbInfo* obbInfo) {
49 return obbInfo->getVersion();
50}
51
52int32_t AObbInfo_getFlags(AObbInfo* obbInfo) {
53 return obbInfo->getFlags();
54}