• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2023 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.phone;
18 
19 import android.provider.DeviceConfig;
20 
21 public final class DataCollectorConfig {
22     public static final long LOGCAT_READ_TIMEOUT_MILLIS_VALUE = 500L;
23     public static final long DUMPSYS_READ_TIMEOUT_MILLIS_VALUE = 100L;
24     public static final long LOGCAT_PROC_TIMEOUT_MILLIS_VALUE = 500L;
25     public static final long DUMPSYS_PROC_TIMEOUT_MILLIS_VALUE = 100L;
26     public static final int MAX_LOGCAT_LINES_LOW_MEM_DEVICE_VALUE = 2000;
27     public static final int MAX_LOGCAT_LINES_VALUE = 8000;
28     private static String LOGCAT_READ_TIMEOUT_MILLIS = "logcat_read_timeout_millis";
29     private static String DUMPSYS_READ_TIMEOUT_MILLIS = "dumpsys_read_timeout_millis";
30     private static String LOGCAT_PROC_TIMEOUT_MILLIS = "logcat_proc_timeout_millis";
31     private static String DUMPSYS_PROC_TIMEOUT_MILLIS = "dumpsys_proc_timeout_millis";
32     private static String MAX_LOGCAT_LINES_LOW_MEM = "max_logcat_lines_low_mem";
33     private static String MAX_LOGCAT_LINES = "max_logcat_lines";
34 
getMaxLogcatLinesForLowMemDevice()35     public static int getMaxLogcatLinesForLowMemDevice() {
36         return DeviceConfig.getInt(DeviceConfig.NAMESPACE_TELEPHONY,
37                 MAX_LOGCAT_LINES_LOW_MEM, MAX_LOGCAT_LINES_LOW_MEM_DEVICE_VALUE);
38     }
39 
getMaxLogcatLines()40     public static int getMaxLogcatLines() {
41         return DeviceConfig.getInt(DeviceConfig.NAMESPACE_TELEPHONY,
42                 MAX_LOGCAT_LINES, MAX_LOGCAT_LINES_VALUE);
43     }
44 
getLogcatReadTimeoutMillis()45     public static long getLogcatReadTimeoutMillis() {
46         return DeviceConfig.getLong(DeviceConfig.NAMESPACE_TELEPHONY,
47                 LOGCAT_READ_TIMEOUT_MILLIS, LOGCAT_READ_TIMEOUT_MILLIS_VALUE);
48     }
49 
getDumpsysReadTimeoutMillis()50     public static long getDumpsysReadTimeoutMillis() {
51         return DeviceConfig.getLong(DeviceConfig.NAMESPACE_TELEPHONY,
52                 DUMPSYS_READ_TIMEOUT_MILLIS, DUMPSYS_READ_TIMEOUT_MILLIS_VALUE);
53     }
54 
getLogcatProcTimeoutMillis()55     public static long getLogcatProcTimeoutMillis() {
56         return DeviceConfig.getLong(DeviceConfig.NAMESPACE_TELEPHONY,
57                 LOGCAT_PROC_TIMEOUT_MILLIS, LOGCAT_PROC_TIMEOUT_MILLIS_VALUE);
58     }
59 
getDumpsysProcTimeoutMillis()60     public static long getDumpsysProcTimeoutMillis() {
61         return DeviceConfig.getLong(DeviceConfig.NAMESPACE_TELEPHONY,
62                 DUMPSYS_PROC_TIMEOUT_MILLIS, DUMPSYS_PROC_TIMEOUT_MILLIS_VALUE);
63     }
64 
65     public static class Adapter {
Adapter()66         public Adapter() {
67         }
68 
getMaxLogcatLinesForLowMemDevice()69         public int getMaxLogcatLinesForLowMemDevice() {
70             return DataCollectorConfig.getMaxLogcatLinesForLowMemDevice();
71         }
72 
getMaxLogcatLines()73         public int getMaxLogcatLines() {
74             return DataCollectorConfig.getMaxLogcatLines();
75         }
76 
getLogcatReadTimeoutMillis()77         public long getLogcatReadTimeoutMillis() {
78             return DataCollectorConfig.getLogcatReadTimeoutMillis();
79         }
80 
getDumpsysReadTimeoutMillis()81         public long getDumpsysReadTimeoutMillis() {
82             return DataCollectorConfig.getDumpsysReadTimeoutMillis();
83         }
84 
getLogcatProcTimeoutMillis()85         public long getLogcatProcTimeoutMillis() {
86             return DataCollectorConfig.getLogcatProcTimeoutMillis();
87         }
88 
getDumpsysProcTimeoutMillis()89         public long getDumpsysProcTimeoutMillis() {
90             return DataCollectorConfig.getDumpsysProcTimeoutMillis();
91         }
92     }
93 
94 
95 }
96