105105f7abe02b2dff91d6260b3628c8b97816babKenny Root/* 205105f7abe02b2dff91d6260b3628c8b97816babKenny Root * Copyright (C) 2010 The Android Open Source Project 305105f7abe02b2dff91d6260b3628c8b97816babKenny Root * 405105f7abe02b2dff91d6260b3628c8b97816babKenny Root * Licensed under the Apache License, Version 2.0 (the "License"); 505105f7abe02b2dff91d6260b3628c8b97816babKenny Root * you may not use this file except in compliance with the License. 605105f7abe02b2dff91d6260b3628c8b97816babKenny Root * You may obtain a copy of the License at 705105f7abe02b2dff91d6260b3628c8b97816babKenny Root * 805105f7abe02b2dff91d6260b3628c8b97816babKenny Root * http://www.apache.org/licenses/LICENSE-2.0 905105f7abe02b2dff91d6260b3628c8b97816babKenny Root * 1005105f7abe02b2dff91d6260b3628c8b97816babKenny Root * Unless required by applicable law or agreed to in writing, software 1105105f7abe02b2dff91d6260b3628c8b97816babKenny Root * distributed under the License is distributed on an "AS IS" BASIS, 1205105f7abe02b2dff91d6260b3628c8b97816babKenny Root * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1305105f7abe02b2dff91d6260b3628c8b97816babKenny Root * See the License for the specific language governing permissions and 1405105f7abe02b2dff91d6260b3628c8b97816babKenny Root * limitations under the License. 1505105f7abe02b2dff91d6260b3628c8b97816babKenny Root */ 1605105f7abe02b2dff91d6260b3628c8b97816babKenny Root 1705105f7abe02b2dff91d6260b3628c8b97816babKenny Root#define LOG_TAG "NObb" 1805105f7abe02b2dff91d6260b3628c8b97816babKenny Root 1905105f7abe02b2dff91d6260b3628c8b97816babKenny Root#include <android/obb.h> 2005105f7abe02b2dff91d6260b3628c8b97816babKenny Root 21b13b9bdad2baf6ad1ec2e56b6b7598fa20f55fc4Mathias Agopian#include <androidfw/ObbFile.h> 2205105f7abe02b2dff91d6260b3628c8b97816babKenny Root#include <utils/Log.h> 2305105f7abe02b2dff91d6260b3628c8b97816babKenny Root 2405105f7abe02b2dff91d6260b3628c8b97816babKenny Rootusing namespace android; 2505105f7abe02b2dff91d6260b3628c8b97816babKenny Root 2605105f7abe02b2dff91d6260b3628c8b97816babKenny Rootstruct AObbInfo : public ObbFile {}; 2705105f7abe02b2dff91d6260b3628c8b97816babKenny Root 2805105f7abe02b2dff91d6260b3628c8b97816babKenny RootAObbInfo* AObbScanner_getObbInfo(const char* filename) { 2905105f7abe02b2dff91d6260b3628c8b97816babKenny Root AObbInfo* obbFile = new AObbInfo(); 3005105f7abe02b2dff91d6260b3628c8b97816babKenny Root if (obbFile == NULL || !obbFile->readFrom(filename)) { 3105105f7abe02b2dff91d6260b3628c8b97816babKenny Root delete obbFile; 3205105f7abe02b2dff91d6260b3628c8b97816babKenny Root return NULL; 3305105f7abe02b2dff91d6260b3628c8b97816babKenny Root } 3405105f7abe02b2dff91d6260b3628c8b97816babKenny Root obbFile->incStrong((void*)AObbScanner_getObbInfo); 3505105f7abe02b2dff91d6260b3628c8b97816babKenny Root return static_cast<AObbInfo*>(obbFile); 3605105f7abe02b2dff91d6260b3628c8b97816babKenny Root} 3705105f7abe02b2dff91d6260b3628c8b97816babKenny Root 3805105f7abe02b2dff91d6260b3628c8b97816babKenny Rootvoid AObbInfo_delete(AObbInfo* obbInfo) { 3905105f7abe02b2dff91d6260b3628c8b97816babKenny Root if (obbInfo != NULL) { 4005105f7abe02b2dff91d6260b3628c8b97816babKenny Root obbInfo->decStrong((void*)AObbScanner_getObbInfo); 4105105f7abe02b2dff91d6260b3628c8b97816babKenny Root } 4205105f7abe02b2dff91d6260b3628c8b97816babKenny Root} 4305105f7abe02b2dff91d6260b3628c8b97816babKenny Root 4405105f7abe02b2dff91d6260b3628c8b97816babKenny Rootconst char* AObbInfo_getPackageName(AObbInfo* obbInfo) { 4505105f7abe02b2dff91d6260b3628c8b97816babKenny Root return obbInfo->getPackageName(); 4605105f7abe02b2dff91d6260b3628c8b97816babKenny Root} 4705105f7abe02b2dff91d6260b3628c8b97816babKenny Root 4805105f7abe02b2dff91d6260b3628c8b97816babKenny Rootint32_t AObbInfo_getVersion(AObbInfo* obbInfo) { 4905105f7abe02b2dff91d6260b3628c8b97816babKenny Root return obbInfo->getVersion(); 5005105f7abe02b2dff91d6260b3628c8b97816babKenny Root} 5105105f7abe02b2dff91d6260b3628c8b97816babKenny Root 5205105f7abe02b2dff91d6260b3628c8b97816babKenny Rootint32_t AObbInfo_getFlags(AObbInfo* obbInfo) { 5305105f7abe02b2dff91d6260b3628c8b97816babKenny Root return obbInfo->getFlags(); 5405105f7abe02b2dff91d6260b3628c8b97816babKenny Root} 55