diff --git a/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfigHelper.java b/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfigHelper.java
index e87d998..bd8ba66 100644
--- a/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfigHelper.java
+++ b/partnerconfig/java/com/google/android/setupcompat/partnerconfig/PartnerConfigHelper.java
@@ -112,6 +112,8 @@
 
   private static PartnerConfigHelper instance = null;
 
+  private final Context mContext;
+
   @VisibleForTesting Bundle resultBundle = null;
 
   @VisibleForTesting
@@ -182,6 +184,7 @@
     getPartnerConfigBundle(context);
 
     registerContentObserver(context);
+    mContext = context;
   }
 
   /**
@@ -190,7 +193,7 @@
    * are customized by the overlay APK.
    */
   public boolean isAvailable() {
-    return resultBundle != null && !resultBundle.isEmpty();
+    return (resultBundle != null && !resultBundle.isEmpty()) || mContext != null;
   }
 
   /**
@@ -200,7 +203,17 @@
    * overlay APK.
    */
   public boolean isPartnerConfigAvailable(PartnerConfig resourceConfig) {
-    return isAvailable() && resultBundle.containsKey(resourceConfig.getResourceName());
+    if (resultBundle != null && !resultBundle.isEmpty())
+      return resultBundle.containsKey(resourceConfig.getResourceName());
+    else {
+      String resType = resourceConfig.getResourceType().name().toLowerCase();
+      if (resType.equals("dimension"))
+        resType = "dimen";
+
+      int resId = mContext.getResources().getIdentifier(resourceConfig.getResourceName(), resType,
+          mContext.getPackageName());
+      return (resId != 0);
+    }
   }
 
   /**
@@ -318,9 +331,20 @@
 
       result = resource.getString(resId);
       partnerResourceCache.put(resourceConfig, result);
+      return result;
     } catch (NullPointerException exception) {
       // fall through
     }
+
+    Resources appResource = context.getResources();
+    int resIdApp = appResource.getIdentifier(resourceConfig.getResourceName(), "string",
+        context.getPackageName());
+
+    if (resIdApp != 0) {
+      result = appResource.getString(resIdApp);
+      partnerResourceCache.put(resourceConfig, result);
+    }
+
     return result;
   }
 
@@ -349,10 +373,21 @@
 
       result = resource.getStringArray(resId);
       Collections.addAll(listResult, result);
+      return listResult;
     } catch (NullPointerException exception) {
       // fall through
     }
 
+    Resources appResource = context.getResources();
+    int resIdApp = appResource.getIdentifier(resourceConfig.getResourceName(), "array",
+        context.getPackageName());
+
+    if (resIdApp != 0) {
+      result = appResource.getStringArray(resIdApp);
+      Collections.addAll(listResult, result);
+      return listResult;
+    }
+
     return listResult;
   }
 
@@ -384,9 +419,20 @@
 
       result = resource.getBoolean(resId);
       partnerResourceCache.put(resourceConfig, result);
+      return result;
     } catch (NullPointerException | NotFoundException exception) {
       // fall through
     }
+
+    Resources appResource = context.getResources();
+    int resIdApp = appResource.getIdentifier(resourceConfig.getResourceName(), "bool",
+        context.getPackageName());
+
+    if (resIdApp != 0) {
+      result = appResource.getBoolean(resIdApp);
+      partnerResourceCache.put(resourceConfig, result);
+    }
+
     return result;
   }
 
@@ -433,9 +479,23 @@
       result =
           getDimensionFromTypedValue(
               context, (TypedValue) partnerResourceCache.get(resourceConfig));
+      return result;
     } catch (NullPointerException | NotFoundException exception) {
       // fall through
     }
+
+    Resources appResource = context.getResources();
+    int resIdApp = appResource.getIdentifier(resourceConfig.getResourceName(), "dimen",
+        context.getPackageName());
+
+    if (resIdApp != 0) {
+      TypedValue value = getTypedValueFromResource(appResource, resIdApp,
+          TypedValue.TYPE_DIMENSION);
+      partnerResourceCache.put(resourceConfig, value);
+      result =
+          getDimensionFromTypedValue(
+              context, (TypedValue) partnerResourceCache.get(resourceConfig));
+    }
     return result;
   }
 
@@ -477,9 +537,19 @@
 
       result = resource.getFraction(resId, 1, 1);
       partnerResourceCache.put(resourceConfig, result);
+      return result;
     } catch (NullPointerException | NotFoundException exception) {
       // fall through
     }
+
+    Resources appResource = context.getResources();
+    int resIdApp = appResource.getIdentifier(resourceConfig.getResourceName(), "fraction",
+        context.getPackageName());
+
+    if (resIdApp != 0) {
+      result = appResource.getFraction(resIdApp, 1, 1);
+      partnerResourceCache.put(resourceConfig, result);
+    }
     return result;
   }
 
@@ -510,9 +580,19 @@
 
       result = resource.getInteger(resId);
       partnerResourceCache.put(resourceConfig, result);
+      return result;
     } catch (NullPointerException | NotFoundException exception) {
       // fall through
     }
+
+    Resources appResource = context.getResources();
+    int resIdApp = appResource.getIdentifier(resourceConfig.getResourceName(), "integer",
+        context.getPackageName());
+
+    if (resIdApp != 0) {
+      result = appResource.getInteger(resIdApp);
+      partnerResourceCache.put(resourceConfig, result);
+    }
     return result;
   }
 
