summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeil Fuller2018-10-10 18:15:52 -0500
committerandroid-build-merger2018-10-10 18:15:52 -0500
commit1b474f8bb75ff1495823aad1c8f6059b6b7d30b3 (patch)
tree1da622a997a857784d10469d127aae24f0462a82
parent956e8424052d19d88315d17982f03a90ed80e06b (diff)
parent59cc3bcdaf79afd37033d4263d8286d5c079a753 (diff)
downloadplatform-packages-services-car-pie-temp.tar.gz
platform-packages-services-car-pie-temp.tar.xz
platform-packages-services-car-pie-temp.zip
Use public APIs not internal APIspie-temp
am: 59cc3bcdaf Change-Id: I1b2fbc29e41a0b6adedfb1f0d12c804305c25ade
-rw-r--r--tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/storagelifetime/StorageLifetimeFragment.java11
1 files changed, 5 insertions, 6 deletions
diff --git a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/storagelifetime/StorageLifetimeFragment.java b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/storagelifetime/StorageLifetimeFragment.java
index bf7af5db..b1341394 100644
--- a/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/storagelifetime/StorageLifetimeFragment.java
+++ b/tests/EmbeddedKitchenSinkApp/src/com/google/android/car/kitchensink/storagelifetime/StorageLifetimeFragment.java
@@ -28,6 +28,7 @@ import android.car.storagemonitoring.IoStatsEntry;
28import android.os.Bundle; 28import android.os.Bundle;
29import android.os.StatFs; 29import android.os.StatFs;
30import android.system.ErrnoException; 30import android.system.ErrnoException;
31import android.system.Os;
31import android.util.Log; 32import android.util.Log;
32import android.view.LayoutInflater; 33import android.view.LayoutInflater;
33import android.view.View; 34import android.view.View;
@@ -41,8 +42,6 @@ import androidx.fragment.app.Fragment;
41import com.google.android.car.kitchensink.KitchenSinkActivity; 42import com.google.android.car.kitchensink.KitchenSinkActivity;
42import com.google.android.car.kitchensink.R; 43import com.google.android.car.kitchensink.R;
43 44
44import libcore.io.Libcore;
45
46import java.io.File; 45import java.io.File;
47import java.io.FileDescriptor; 46import java.io.FileDescriptor;
48import java.io.IOException; 47import java.io.IOException;
@@ -148,16 +147,16 @@ public class StorageLifetimeFragment extends Fragment {
148 private void fsyncFile() { 147 private void fsyncFile() {
149 try { 148 try {
150 final Path filePath = getFilePath(); 149 final Path filePath = getFilePath();
151 FileDescriptor fd = Libcore.os.open(filePath.toString(), O_APPEND | O_RDWR, 0); 150 FileDescriptor fd = Os.open(filePath.toString(), O_APPEND | O_RDWR, 0);
152 if (!fd.valid()) { 151 if (!fd.valid()) {
153 Log.w(TAG, "file descriptor is invalid"); 152 Log.w(TAG, "file descriptor is invalid");
154 return; 153 return;
155 } 154 }
156 // fill byteBuffer with arbitrary data in order to make an fsync() meaningful 155 // fill byteBuffer with arbitrary data in order to make an fsync() meaningful
157 ByteBuffer byteBuffer = ByteBuffer.wrap(new byte[] {101, 110, 114, 105, 99, 111}); 156 ByteBuffer byteBuffer = ByteBuffer.wrap(new byte[] {101, 110, 114, 105, 99, 111});
158 Libcore.os.write(fd, byteBuffer); 157 Os.write(fd, byteBuffer);
159 Libcore.os.fsync(fd); 158 Os.fsync(fd);
160 Libcore.os.close(fd); 159 Os.close(fd);
161 } catch (ErrnoException | IOException e) { 160 } catch (ErrnoException | IOException e) {
162 Log.w(TAG, "could not fsync data", e); 161 Log.w(TAG, "could not fsync data", e);
163 } 162 }