Compare commits
2 Commits
3b1b92ba45
...
0fa4011d4f
| Author | SHA1 | Date | |
|---|---|---|---|
| 0fa4011d4f | |||
| 95719ea53b |
@@ -12,8 +12,8 @@ android {
|
||||
applicationId "at.lockstep"
|
||||
minSdk 24
|
||||
targetSdk 34
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
versionCode 10002
|
||||
versionName "1.0.2"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
vectorDrawables {
|
||||
|
||||
@@ -6,6 +6,8 @@ import android.app.NotificationManager;
|
||||
import android.app.Service;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.hardware.Sensor;
|
||||
import android.hardware.SensorEvent;
|
||||
import android.hardware.SensorEventListener;
|
||||
@@ -225,7 +227,7 @@ public class LstForegroundService extends Service implements SensorEventListener
|
||||
}
|
||||
public SensorData(long timestamp, float[] values) {
|
||||
this.timestamp = timestamp;
|
||||
this.values = values;
|
||||
this.values = Arrays.copyOf(values, values.length);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -233,10 +235,12 @@ public class LstForegroundService extends Service implements SensorEventListener
|
||||
public static class SensorDataArray {
|
||||
private ArrayList<SensorData> data = new ArrayList<SensorData>();
|
||||
private String meta;
|
||||
private int versionCode;
|
||||
public void add(SensorEvent event) { data.add(new SensorData(event)); }
|
||||
public void add(SensorData d) { data.add(d); }
|
||||
public void clear() { data.clear(); }
|
||||
public void setMeta(String meta) { this.meta = meta; }
|
||||
public void setVersionCode(int versionCode) { this.versionCode = versionCode; }
|
||||
}
|
||||
|
||||
private final SensorDataArray recording = new SensorDataArray();
|
||||
@@ -245,6 +249,11 @@ public class LstForegroundService extends Service implements SensorEventListener
|
||||
private void onStartRecording(String meta) {
|
||||
recordingStartTime = SystemClock.elapsedRealtimeNanos();
|
||||
recording.setMeta(meta);
|
||||
|
||||
try {
|
||||
PackageInfo pInfo = this.getPackageManager().getPackageInfo(this.getPackageName(), 0);
|
||||
recording.setVersionCode(pInfo.versionCode);
|
||||
} catch (PackageManager.NameNotFoundException ignored) {}
|
||||
}
|
||||
private void onStopRecording() {
|
||||
if(listener != null) {
|
||||
|
||||
@@ -106,15 +106,17 @@ public class MediaStoreBenchmarkActivity extends Activity {
|
||||
MediaStore.Audio.Media.TITLE + " ASC"
|
||||
)) {
|
||||
if (cursor != null) {
|
||||
int idColumn = cursor.getColumnIndexOrThrow(MediaStore.Audio.Media._ID);
|
||||
int titleColumn = cursor.getColumnIndexOrThrow(MediaStore.Audio.Media.TITLE);
|
||||
int dataColumn = cursor.getColumnIndex(MediaStore.Audio.Media.DATA);
|
||||
|
||||
while (cursor.moveToNext()) {
|
||||
String contentUri = cursor.getString(idColumn); // the content:// Uri for the MediaStore item
|
||||
String title = cursor.getString(titleColumn);
|
||||
String path = dataColumn != -1 ? cursor.getString(dataColumn) : null;
|
||||
|
||||
if (path != null) {
|
||||
musicList.add(title + "\n" + path);
|
||||
musicList.add(title + "\n" + path + "\n" + contentUri);
|
||||
} else {
|
||||
musicList.add(title + "\n[path unavailable]");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user