When the folder path is returned from N-tier to the N-19 layer, the file manager exits automatically, such as when the 63-level press back key returns to level 44, the file manager exits automatically.
1.FileManager Default Design, FileManager records only up to 20 operation paths, if exceeded, will delete the oldest record. Your company can refer to this part of the code in Alps/mediatek/packages/apps/filemanager/src/com/mediatek/filemanager/fileinfomanager.java.
/** Max History Size */
private static final int max_list_size = 20;
Private final list<navigationrecord> mnavigationlist = new linkedlist<navigationrecord> ();
/**
* This method gets the previous navigation directory path
*
* @return the previous navigation path
*/
Protected Navigationrecord getprevnavigation () {
while (!mnavigationlist.isempty ()) {
Navigationrecord Navrecord = Mnavigationlist.get (Mnavigationlist.size ()-1);
Removefromnavigationlist ();
String path = Navrecord.getrecordpath ();
if (! Textutils.isempty (path)) {
if (new File (path). Exists () | | Mountpointmanager.getinstance (). Isrootpath (path)) {
return Navrecord;
}
}
}
return null;
}
/**
* This method adds a navigationrecord to the navigation
*
* @param navigationrecord the Record
*/
protected void Addtonavigationlist (Navigationrecord navigationrecord) {
if (Mnavigationlist.size () <= max_list_size) {
Mnavigationlist.add (Navigationrecord);
} else {
Mnavigationlist.remove (0);
Mnavigationlist.add (Navigationrecord);
}
}
/**
* This method removes a directory path from the navigation
*/
protected void Removefromnavigationlist () {
if (!mnavigationlist.isempty ()) {
Mnavigationlist.remove (Mnavigationlist.size ()-1);
}
}
2. For the history record of 20 operating paths, you can modify the Max_list_size to set the maximum number of path records required in FileInfo.Manager.java. The effect of this modification is that the File Manager apk may use more memory because the list<navigationrecord> mnavigationlist needs to record more paths.
This part of the code in Alps/mediatek/packages/apps/filemanager/src/com/mediatek/filemanager/fileinfomanager.java.
/** Max History Size */
private static final int max_list_size = XXX;
Android File Manager exits automatically when the folder path is returned to the N-19 layer by pressing the back key from N-tier