1 // 2 // Copyright (C) 2017 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 package com.android.verifiedboot.storage; 18 19 import javacard.framework.AID; 20 import javacard.framework.CardRuntimeException; 21 import javacard.framework.Shareable; 22 import javacard.framework.Util; 23 24 import com.android.verifiedboot.storage.BackupInterface; 25 26 public class DefaultOsBackupImpl implements OsBackupInterface { 27 private BackupInterface[] objects; 28 DefaultOsBackupImpl()29 public DefaultOsBackupImpl() { 30 objects = new BackupInterface[OsBackupInterface.TAG_MAX + 1]; 31 } 32 33 /** 34 * {@inheritDoc} 35 */ 36 @Override track(byte tag, Object obj)37 public void track(byte tag, Object obj) { 38 objects[tag] = (BackupInterface)obj; 39 } 40 41 /** 42 * Return the tracked objects to subclasses. 43 */ tracked()44 protected BackupInterface[] tracked() { 45 return objects; 46 } 47 48 /** 49 * {@inheritDoc} 50 * 51 * Not implemented. 52 */ 53 @Override restore(byte[] inBytes, short inBytesOffset)54 public boolean restore(byte[] inBytes, short inBytesOffset) { 55 return false; 56 } 57 58 /** 59 * Returns |this|. 60 * 61 * @param AID Unused. 62 * @param arg Unused. 63 * @return this interface. 64 */ getShareableInterfaceObject(AID clientAid, byte arg)65 public Shareable getShareableInterfaceObject(AID clientAid, byte arg) { 66 return this; 67 } 68 } 69