Loading core/java/android/alsa/AlsaCardsParser.java +11 −4 Original line number Diff line number Diff line Loading @@ -31,6 +31,8 @@ public class AlsaCardsParser { private static final String TAG = "AlsaCardsParser"; protected static final boolean DEBUG = true; private static final String kCardsFilePath = "/proc/asound/cards"; private static LineTokenizer mTokenizer = new LineTokenizer(" :[]"); private ArrayList<AlsaCardRecord> mCardRecords = new ArrayList<AlsaCardRecord>(); Loading @@ -56,8 +58,14 @@ public class AlsaCardsParser { tokenIndex = mTokenizer.nextToken(line, tokenIndex); delimIndex = mTokenizer.nextDelimiter(line, tokenIndex); try { // mCardNum mCardNum = Integer.parseInt(line.substring(tokenIndex, delimIndex)); } catch (NumberFormatException e) { Slog.e(TAG, "Failed to parse line " + lineIndex + " of " + kCardsFilePath + ": " + line.substring(tokenIndex, delimIndex)); return false; } // mField1 tokenIndex = mTokenizer.nextToken(line, delimIndex); Loading Loading @@ -93,8 +101,7 @@ public class AlsaCardsParser { } mCardRecords = new ArrayList<AlsaCardRecord>(); final String cardsFilePath = "/proc/asound/cards"; File cardsFile = new File(cardsFilePath); File cardsFile = new File(kCardsFilePath); try { FileReader reader = new FileReader(cardsFile); BufferedReader bufferedReader = new BufferedReader(reader); Loading core/java/android/alsa/AlsaDevicesParser.java +54 −47 Original line number Diff line number Diff line Loading @@ -31,6 +31,8 @@ public class AlsaDevicesParser { private static final String TAG = "AlsaDevicesParser"; protected static final boolean DEBUG = false; private static final String kDevicesFilePath = "/proc/asound/devices"; private static final int kIndex_CardDeviceField = 5; private static final int kStartIndex_CardNum = 6; private static final int kEndIndex_CardNum = 8; // one past Loading Loading @@ -89,6 +91,7 @@ public class AlsaDevicesParser { } String token = line.substring(tokenOffset, delimOffset); try { switch (tokenIndex) { case kToken_LineNum: // ignore Loading Loading @@ -134,6 +137,11 @@ public class AlsaDevicesParser { } break; } // switch (tokenIndex) } catch (NumberFormatException e) { Slog.e(TAG, "Failed to parse token " + tokenIndex + " of " + kDevicesFilePath + " token: " + token); return false; } tokenIndex++; } // while (true) Loading Loading @@ -245,8 +253,7 @@ public class AlsaDevicesParser { public void scan() { mDeviceRecords.clear(); final String devicesFilePath = "/proc/asound/devices"; File devicesFile = new File(devicesFilePath); File devicesFile = new File(kDevicesFilePath); try { FileReader reader = new FileReader(devicesFile); BufferedReader bufferedReader = new BufferedReader(reader); Loading Loading
core/java/android/alsa/AlsaCardsParser.java +11 −4 Original line number Diff line number Diff line Loading @@ -31,6 +31,8 @@ public class AlsaCardsParser { private static final String TAG = "AlsaCardsParser"; protected static final boolean DEBUG = true; private static final String kCardsFilePath = "/proc/asound/cards"; private static LineTokenizer mTokenizer = new LineTokenizer(" :[]"); private ArrayList<AlsaCardRecord> mCardRecords = new ArrayList<AlsaCardRecord>(); Loading @@ -56,8 +58,14 @@ public class AlsaCardsParser { tokenIndex = mTokenizer.nextToken(line, tokenIndex); delimIndex = mTokenizer.nextDelimiter(line, tokenIndex); try { // mCardNum mCardNum = Integer.parseInt(line.substring(tokenIndex, delimIndex)); } catch (NumberFormatException e) { Slog.e(TAG, "Failed to parse line " + lineIndex + " of " + kCardsFilePath + ": " + line.substring(tokenIndex, delimIndex)); return false; } // mField1 tokenIndex = mTokenizer.nextToken(line, delimIndex); Loading Loading @@ -93,8 +101,7 @@ public class AlsaCardsParser { } mCardRecords = new ArrayList<AlsaCardRecord>(); final String cardsFilePath = "/proc/asound/cards"; File cardsFile = new File(cardsFilePath); File cardsFile = new File(kCardsFilePath); try { FileReader reader = new FileReader(cardsFile); BufferedReader bufferedReader = new BufferedReader(reader); Loading
core/java/android/alsa/AlsaDevicesParser.java +54 −47 Original line number Diff line number Diff line Loading @@ -31,6 +31,8 @@ public class AlsaDevicesParser { private static final String TAG = "AlsaDevicesParser"; protected static final boolean DEBUG = false; private static final String kDevicesFilePath = "/proc/asound/devices"; private static final int kIndex_CardDeviceField = 5; private static final int kStartIndex_CardNum = 6; private static final int kEndIndex_CardNum = 8; // one past Loading Loading @@ -89,6 +91,7 @@ public class AlsaDevicesParser { } String token = line.substring(tokenOffset, delimOffset); try { switch (tokenIndex) { case kToken_LineNum: // ignore Loading Loading @@ -134,6 +137,11 @@ public class AlsaDevicesParser { } break; } // switch (tokenIndex) } catch (NumberFormatException e) { Slog.e(TAG, "Failed to parse token " + tokenIndex + " of " + kDevicesFilePath + " token: " + token); return false; } tokenIndex++; } // while (true) Loading Loading @@ -245,8 +253,7 @@ public class AlsaDevicesParser { public void scan() { mDeviceRecords.clear(); final String devicesFilePath = "/proc/asound/devices"; File devicesFile = new File(devicesFilePath); File devicesFile = new File(kDevicesFilePath); try { FileReader reader = new FileReader(devicesFile); BufferedReader bufferedReader = new BufferedReader(reader); Loading