Move some methods to DeviceInfoUtils in SettingsLib

Change-Id: I3d51e4d0d376d03dfe5f9f667d4586f17c07f3e1
This commit is contained in:
Tony Mantler
2015-11-10 10:40:07 -08:00
parent 25fd4eaf1e
commit 4559b5d62f
2 changed files with 30 additions and 163 deletions

View File

@@ -18,37 +18,37 @@ package com.android.settings;
import android.test.AndroidTestCase;
import com.android.settings.DeviceInfoSettings;
import com.android.settingslib.DeviceInfoUtils;
public class DeviceInfoSettingsTest extends AndroidTestCase {
public void testGetFormattedKernelVersion() throws Exception {
if ("Unavailable".equals(DeviceInfoSettings.getFormattedKernelVersion())) {
if ("Unavailable".equals(DeviceInfoUtils.getFormattedKernelVersion())) {
fail("formatKernelVersion can't cope with this device's /proc/version");
}
}
public void testFormatKernelVersion() throws Exception {
assertEquals("Unavailable", DeviceInfoSettings.formatKernelVersion(""));
assertEquals("Unavailable", DeviceInfoUtils.formatKernelVersion(""));
assertEquals("2.6.38.8-gg784\n" +
"root@hpao4.eem.corp.google.com #2\n" +
"Fri Feb 24 03:31:23 PST 2012",
DeviceInfoSettings.formatKernelVersion("Linux version 2.6.38.8-gg784 " +
"(root@hpao4.eem.corp.google.com) " +
"(gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5) ) #2 SMP " +
"Fri Feb 24 03:31:23 PST 2012"));
"root@hpao4.eem.corp.google.com #2\n" +
"Fri Feb 24 03:31:23 PST 2012",
DeviceInfoUtils.formatKernelVersion("Linux version 2.6.38.8-gg784 " +
"(root@hpao4.eem.corp.google.com) " +
"(gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5) ) #2 SMP " +
"Fri Feb 24 03:31:23 PST 2012"));
assertEquals("3.0.31-g6fb96c9\n" +
"android-build@vpbs1.mtv.corp.google.com #1\n" +
"Thu Jun 28 11:02:39 PDT 2012",
DeviceInfoSettings.formatKernelVersion("Linux version 3.0.31-g6fb96c9 " +
"(android-build@vpbs1.mtv.corp.google.com) " +
"(gcc version 4.6.x-google 20120106 (prerelease) (GCC) ) #1 " +
"SMP PREEMPT Thu Jun 28 11:02:39 PDT 2012"));
"android-build@vpbs1.mtv.corp.google.com #1\n" +
"Thu Jun 28 11:02:39 PDT 2012",
DeviceInfoUtils.formatKernelVersion("Linux version 3.0.31-g6fb96c9 " +
"(android-build@vpbs1.mtv.corp.google.com) " +
"(gcc version 4.6.x-google 20120106 (prerelease) (GCC) ) #1 " +
"SMP PREEMPT Thu Jun 28 11:02:39 PDT 2012"));
assertEquals("2.6.38.8-a-b-jellybean+\n" +
"x@y #1\n" +
"Tue Aug 28 22:10:46 CDT 2012",
DeviceInfoSettings.formatKernelVersion("Linux version " +
"2.6.38.8-a-b-jellybean+ (x@y) " +
"(gcc version 4.4.3 (GCC) ) #1 PREEMPT Tue Aug 28 22:10:46 CDT 2012"));
"x@y #1\n" +
"Tue Aug 28 22:10:46 CDT 2012",
DeviceInfoUtils.formatKernelVersion("Linux version " +
"2.6.38.8-a-b-jellybean+ (x@y) " +
"(gcc version 4.4.3 (GCC) ) #1 PREEMPT Tue Aug 28 22:10:46 CDT 2012"));
}
}