Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
briar
briar
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 681
    • Issues 681
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 16
    • Merge Requests 16
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • briar
  • briarbriar
  • Issues
  • #51

Closed
Open
Opened Dec 01, 2015 by akwizgran@akwizgranOwner
  • Report abuse
  • New issue
Report abuse New issue

Can we trigger the TRIM command on Android?

Android 4.3 uses the TRIM command to erase blocks of flash that are unused by the filesystem. This could improve our chances of securely deleting data on Android.

MountService issues the TRIM command once every 24 hours if the device is idle and charged, as determined by IdleMaintenanceService:

https://android.googlesource.com/platform/frameworks/base/+/master/services/java/com/android/server/IdleMaintenanceService.java

Investigate whether we can broadcast any of the intents issued by IdleMaintenanceService to cause a TRIM on demand, e.g. in a panic button situation after deleting the database.

We can broadcast an intent with the action "com.android.server.IdleMaintenanceService.action.FORCE_IDLE_MAINTENANCE", but it's not clear whether that has any effect - nothing shows up in the logs on a Galaxy Nexus with Android 4.3 when the intent is broadcast.

When IdleMaintenanceService decides (due to receiving the above intent or otherwise) that it's time to run idle maintenance tasks, it broadcasts an intent with the action "android.intent.action.ACTION_IDLE_MAINTENANCE_START". According to the Intent javadoc, that intent "can only be sent by the system":

https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/content/Intent.java

Alternatively, we might be able to invoke android.app.ActivityManagerNative.getDefault().performIdleMaintenance() via reflection. The method in question was added in September 2013:

https://android.googlesource.com/platform/frameworks/base/+blame/master/core/java/android/app/ActivityManagerNative.java

It's included in the kitkat-release branch but not the jb-release branch, so we'd need a phone with 4.4 to test this.

Edited Nov 16, 2020 by akwizgran
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: briar/briar#51