ProcessedData.java revision d074e30ce44b9e33da43b67a4515b8986ca72b26
1/*
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
17package android.drm;
18
19/**
20 * This is an entity class which wraps the result of transaction between
21 * device and online DRM server by using {@link DrmManagerClient#processDrmInfo(DrmInfo)}
22 *
23 * In license acquisition scenario this class would hold the binary data
24 * of rights information.
25 *
26 */
27public class ProcessedData {
28    private final byte[] mData;
29    private String mAccountId = "_NO_USER";
30    private String mSubscriptionId = "";
31
32    /**
33     * constructor to create ProcessedData object with given parameters
34     *
35     * @param data Rights data
36     * @param accountId Account Id of the user
37     */
38    /* package */ ProcessedData(byte[] data, String accountId) {
39        mData = data;
40        mAccountId = accountId;
41    }
42
43    /**
44     * constructor to create ProcessedData object with given parameters
45     *
46     * @param data Rights data
47     * @param accountId Account Id of the user
48     * @param subscriptionId Subscription Id of the user
49     */
50    /* package */ ProcessedData(byte[] data, String accountId, String subscriptionId) {
51        mData = data;
52        mAccountId = accountId;
53        mSubscriptionId = subscriptionId;
54    }
55
56    /**
57     * Returns the processed data as a result.
58     *
59     * @return Rights data associated
60     */
61    public byte[] getData() {
62        return mData;
63    }
64
65    /**
66     * Returns the account-id associated with this object
67     *
68     * @return Account Id associated
69     */
70    public String getAccountId() {
71        return mAccountId;
72    }
73
74    /**
75     * Returns the subscription-id associated with this object
76     *
77     * @return Subscription Id associated
78     */
79    public String getSubscriptionId() {
80        return mSubscriptionId;
81    }
82}
83
84