asus nexus 7 sw workaround for a broken orientation sensor

install apps that force portrait mode and force landscape mode such as

ms auth (forces portrait)

zxing barcode scanner (forces landscape)

then run and exit either of these apps BEFORE the app you want to run in portrait or landscape