Port PER APP EXPAND Function and code cleanup

frameworks already there

Change-Id: Iff512af8db75676aee3fb7cb343808426256e3c2