• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2017 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5  * in compliance with the License. You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software distributed under the License
10  * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11  * or implied. See the License for the specific language governing permissions and limitations under
12  * the License.
13  */
14 package lockedregioncodeinjection;
15 
16 import java.util.ArrayList;
17 import java.util.List;
18 import org.objectweb.asm.Opcodes;
19 
20 public class Utils {
21 
22     public static final int ASM_VERSION = Opcodes.ASM6;
23 
24     /**
25      * Reads a comma separated configuration similar to the Jack definition.
26      */
getTargetsFromLegacyJackConfig(String classList, String requestList, String resetList)27     public static List<LockTarget> getTargetsFromLegacyJackConfig(String classList,
28             String requestList, String resetList) {
29 
30         String[] classes = classList.split(",");
31         String[] requests = requestList.split(",");
32         String[] resets = resetList.split(",");
33 
34         int total = classes.length;
35         assert requests.length == total;
36         assert resets.length == total;
37 
38         List<LockTarget> config = new ArrayList<LockTarget>();
39 
40         for (int i = 0; i < total; i++) {
41             config.add(new LockTarget(classes[i], requests[i], resets[i]));
42         }
43 
44         return config;
45     }
46 }
47