Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • briar briar
  • Project information
    • Project information
    • Activity
    • Labels
    • Planning hierarchy
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 788
    • Issues 788
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 8
    • Merge requests 8
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • briar
  • briarbriar
  • Issues
  • #51

Closed
Open
Created Dec 01, 2015 by akwizgran@akwizgranOwner

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
Time tracking