The <p/> tags are for listing which widget is using which package/class already installed... Order is important as it is referenced from the <g /> tags.
The <h/> tags lists all launcher installed, its package name and id. It seems custom launchers loaded from market have all an id of 400!
The <g/> tags are the actual widgets already added to a launcher/home screen,
it's ID is the dev ID used by apps, unique on a single device
the h= attribute is the launcher reference (0, 1, ...) from the <h/> tags above.
the p= attribute is the package ref (0, 1, ...) from the <p/> tags above.
That file is updated when an launcher/home screen app calls many Android API methods, including those:
allocateAppWidgetId() to get a new dev ID as mentioned above and link future <g> tags to an existing <h> tag.
The h tag is ALWAYS a reference to the package having called this method! No way to get a widget ID from another app for a particular launcher!
bindAppWidgetId(int appWidgetId, ComponentName provider) to link the <g> tag along with the <p> tag
Even tried ADW Launcher and its home-screen backup/restore but it fails to restore anything!? What a crap!
I personnally use 'System Tuner' which actually restores home screens, except the widgets! Is Titanium Backup able to restore home screens widget?
I've been messing around with the appwidgets.xml file manually to restore a widget... Unfortunately nothing worked.
Did anyone found more info on the subject?