└── oneplus-fwk ├── Android.bp └── src └── android ├── os └── OPDiagnoseManager.java └── util └── OpFeatures.java /oneplus-fwk/Android.bp: -------------------------------------------------------------------------------- 1 | java_library { 2 | name: "oneplus-fwk", 3 | installable: true, 4 | 5 | srcs: [ 6 | "src/**/*.java", 7 | ], 8 | } 9 | -------------------------------------------------------------------------------- /oneplus-fwk/src/android/os/OPDiagnoseManager.java: -------------------------------------------------------------------------------- 1 | package android.os; 2 | 3 | public final class OPDiagnoseManager { 4 | 5 | private static String LOG_TAG = OPDiagnoseManager.class.getSimpleName(); 6 | 7 | public boolean addIssueCount(int type, int count) { 8 | return true; 9 | } 10 | 11 | public boolean setIssueNumber(int type, int count) { 12 | return true; 13 | } 14 | 15 | public boolean writeDiagData(int type, String issueDesc) { 16 | return true; 17 | } 18 | 19 | public boolean setDiagData(int type, String issueDesc, int count) { 20 | return true; 21 | } 22 | 23 | public boolean saveDiagLog(int type) { 24 | return true; 25 | } 26 | 27 | public boolean saveQxdmLog(int type, String mask_type) { 28 | return true; 29 | } 30 | 31 | public boolean readDiagData(int type) { 32 | return true; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /oneplus-fwk/src/android/util/OpFeatures.java: -------------------------------------------------------------------------------- 1 | package android.util; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.File; 5 | import java.io.FileReader; 6 | import java.io.IOException; 7 | import java.util.BitSet; 8 | 9 | public final class OpFeatures { 10 | 11 | private static String LOG_TAG = OpFeatures.class.getSimpleName(); 12 | 13 | private static final BitSet sFeatures = new BitSet(); 14 | 15 | static { 16 | File file = new File("/odm/etc/odm_feature_list"); 17 | 18 | try (BufferedReader br = new BufferedReader(new FileReader(file))) { 19 | for (String line = br.readLine(); line != null; line = br.readLine()) { 20 | String[] values = line.split(" "); 21 | if (values.length == 4 && values[3].equals("true")) { 22 | String id = values[0].replaceAll("[^0-9]", ""); 23 | if (id.length() != 0) { 24 | sFeatures.set(Integer.parseInt(id)); 25 | } 26 | } 27 | } 28 | } catch (IOException e) { 29 | Log.e(LOG_TAG, "Failed to read odm feature list file", e); 30 | } 31 | } 32 | 33 | public static boolean isSupport(int... features) { 34 | for (int feature : features) { 35 | if (feature < 0 || !sFeatures.get(feature)) { 36 | return false; 37 | } 38 | } 39 | return true; 40 | } 41 | } 42 | --------------------------------------------------------------------------------