1791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang/*
2791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang * Copyright (C) 2017 The Android Open Source Project
3791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang *
4791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang * Licensed under the Apache License, Version 2.0 (the "License");
5791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang * you may not use this file except in compliance with the License.
6791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang * You may obtain a copy of the License at
7791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang *
8791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang *      http://www.apache.org/licenses/LICENSE-2.0
9791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang *
10791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang * Unless required by applicable law or agreed to in writing, software
11791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang * distributed under the License is distributed on an "AS IS" BASIS,
12791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang * See the License for the specific language governing permissions and
14791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang * limitations under the License.
15791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang */
16791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang
17791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang//#define LOG_NDEBUG 0
18791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang#define LOG_TAG "ClearKeyLicenseFetcher"
19791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang
20791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang#include "ClearKeyLicenseFetcher.h"
21791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang#include "protos/license_protos.pb.h"
22791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang
23791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang#include <utils/Log.h>
24791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang#include <utils/String8.h>
25791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang#include "JsonAssetLoader.h"
26791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang
27791a1a206b56be8601a6fffd2614926e67d64790Chong Zhangnamespace android {
28791a1a206b56be8601a6fffd2614926e67d64790Chong Zhangnamespace clearkeycas {
29791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang
30791a1a206b56be8601a6fffd2614926e67d64790Chong Zhangstatus_t ClearKeyLicenseFetcher::Init(const char *input) {
31791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang    JsonAssetLoader *extractor = new JsonAssetLoader();
32791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang    return extractor->extractAssetFromString(String8(input), &asset_);
33791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang}
34791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang
35791a1a206b56be8601a6fffd2614926e67d64790Chong Zhangstatus_t ClearKeyLicenseFetcher::FetchLicense(
36791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang        uint64_t /* asset_id */, Asset* asset) {
37791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang    *asset = asset_;
38791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang    return OK;
39791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang}
40791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang
41791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang}  // namespace clearkeycas
42791a1a206b56be8601a6fffd2614926e67d64790Chong Zhang}  // namespace android
43