Skip to content

Commit

Permalink
remove additional unused code from previous media monitoring efforts
Browse files Browse the repository at this point in the history
  • Loading branch information
n8fr8 committed Jan 22, 2024
1 parent dac9878 commit fc03270
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 69 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,7 @@ public class ProofMode {
Security.addProvider(sProvider);
}

private static CameraEventReceiver mReceiver;

private static boolean mInit = false;
public final static String NEW_MEDIA_EVENT = "org.witness.proofmode.NEW_MEDIA";

public synchronized static void initBackgroundService (Context context)
{
Expand All @@ -109,13 +106,6 @@ public synchronized static void initBackgroundService (Context context)
VideosContentJob.scheduleJob(context);
}

if (mReceiver == null) {
mReceiver = new CameraEventReceiver();
//internal camera event
LocalBroadcastManager.getInstance(context).
registerReceiver(mReceiver, new IntentFilter("org.witness.proofmode.NEW_MEDIA"));
}

startLocationListener(context);

mInit = true;
Expand All @@ -135,11 +125,6 @@ public static void stopBackgroundService (Context context)
PhotosContentJob.cancelJob(context);
VideosContentJob.cancelJob(context);

if (mReceiver != null)
context.unregisterReceiver(mReceiver);

LocalBroadcastManager.getInstance(context).unregisterReceiver(mReceiver);

MediaWatcher.getInstance(context).stop();

if (mLocationTracker != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ private MediaWatcher (Context context) {
mContext = context;
mPassphrase = mPrefs.getString(PREFS_KEY_PASSPHRASE,PREFS_KEY_PASSPHRASE_DEFAULT);

startFileSystemMonitor();
}


Expand Down Expand Up @@ -995,59 +994,6 @@ public boolean checkPermissionForLocation() {
return true;
}

// public static FileObserver observerMedia;

public Stack<String> qMedia = new Stack<>();
public Timer qTimer = null;

private void startFileSystemMonitor() {

if (checkPermissionForReadExternalStorage()) {

String pathToWatch = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM).getAbsolutePath();

/**
observerMedia = new RecursiveFileObserver(pathToWatch, FileObserver.MODIFY|FileObserver.CLOSE_WRITE|FileObserver.MOVED_TO) { // set up a file observer to watch this directory on sd card
@Override
public void onEvent(int event, final String mediaPath) {
if (mediaPath != null && (!mediaPath.equals(".probe"))) { // check that it's not equal to .probe because thats created every time camera is launched
if (!qMedia.contains(mediaPath))
qMedia.push(mediaPath);
if (qTimer != null)
{
qTimer.cancel();
qTimer.purge();
qTimer = null;
}
qTimer = new Timer();
qTimer.schedule(new TimerTask() {
@Override
public void run() {
while (!qMedia.isEmpty())
{
File fileMedia = new File(qMedia.pop());
if (fileMedia.exists())
processUri(Uri.fromFile(fileMedia), true);
}
}
}, MediaWatcher.PROOF_GENERATION_DELAY_TIME_MS);
}
}
};
observerMedia.startWatching();
**/

}


}

public void stop () {

/**
Expand Down

0 comments on commit fc03270

Please sign in to comment.