Fix cycle detection for SGs.
Fix cycle detection for SGs.

bug 7318821

Change-Id: I695d7230551d8512c6c3f0c31c57f12498da7036

xorware/android_frameworks_base,xorware/android_frameworks_base,xorware/android_frameworks_base,xorware/android_frameworks_base,xorware/android_frameworks_base,xorware/android_frameworks_base